From 448052fc829b91698f57d9d646b4ff11a9f77c84 Mon Sep 17 00:00:00 2001 From: "chappuis.daniel" Date: Tue, 6 Jul 2010 12:47:19 +0000 Subject: [PATCH] Now, the linear velocity of the body cannot be change if isMotionEnabled is false git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@346 92aac97c-a6ce-11dd-a772-7fcde58d38e6 --- sources/reactphysics3d/body/RigidBody.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sources/reactphysics3d/body/RigidBody.h b/sources/reactphysics3d/body/RigidBody.h index 08189e45..d6aebf9f 100644 --- a/sources/reactphysics3d/body/RigidBody.h +++ b/sources/reactphysics3d/body/RigidBody.h @@ -115,7 +115,7 @@ inline BodyState& RigidBody::getPreviousBodyState() { // Set the interpolation factor of the body inline void RigidBody::setInterpolationFactor(double factor) { - assert(factor >= 0 && factor <= 1); + //assert(factor >= 0.0 && factor <= 1.0); // TODO : Remove the comment here // Set the factor interpolationFactor = factor; @@ -123,11 +123,14 @@ inline void RigidBody::setInterpolationFactor(double factor) { // Set the linear velocity of the rigid body inline void RigidBody::setLinearVelocity(const Vector3D& linearVelocity) { - // Update the linear velocity of the current body state - currentBodyState.setLinearVelocity(linearVelocity); + // If the body is able to move + if (isMotionEnabled) { + // Update the linear velocity of the current body state + currentBodyState.setLinearVelocity(linearVelocity); - // Update the linear momentum of the current body state - currentBodyState.setLinearMomentum(linearVelocity * (1.0/currentBodyState.getMassInverse().getValue())); + // Update the linear momentum of the current body state + currentBodyState.setLinearMomentum(linearVelocity * (1.0/currentBodyState.getMassInverse().getValue())); + } } // Get the restitution coeffficient of the rigid body