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
This commit is contained in:
parent
df4f379dde
commit
448052fc82
|
@ -115,7 +115,7 @@ inline BodyState& RigidBody::getPreviousBodyState() {
|
||||||
|
|
||||||
// Set the interpolation factor of the body
|
// Set the interpolation factor of the body
|
||||||
inline void RigidBody::setInterpolationFactor(double factor) {
|
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
|
// Set the factor
|
||||||
interpolationFactor = factor;
|
interpolationFactor = factor;
|
||||||
|
@ -123,12 +123,15 @@ inline void RigidBody::setInterpolationFactor(double factor) {
|
||||||
|
|
||||||
// Set the linear velocity of the rigid body
|
// Set the linear velocity of the rigid body
|
||||||
inline void RigidBody::setLinearVelocity(const Vector3D& linearVelocity) {
|
inline void RigidBody::setLinearVelocity(const Vector3D& linearVelocity) {
|
||||||
|
// If the body is able to move
|
||||||
|
if (isMotionEnabled) {
|
||||||
// Update the linear velocity of the current body state
|
// Update the linear velocity of the current body state
|
||||||
currentBodyState.setLinearVelocity(linearVelocity);
|
currentBodyState.setLinearVelocity(linearVelocity);
|
||||||
|
|
||||||
// Update the linear momentum of the current body state
|
// Update the linear momentum of the current body state
|
||||||
currentBodyState.setLinearMomentum(linearVelocity * (1.0/currentBodyState.getMassInverse().getValue()));
|
currentBodyState.setLinearMomentum(linearVelocity * (1.0/currentBodyState.getMassInverse().getValue()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get the restitution coeffficient of the rigid body
|
// Get the restitution coeffficient of the rigid body
|
||||||
inline double RigidBody::getRestitution() const {
|
inline double RigidBody::getRestitution() const {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user