added lost rebound deltatime compensation

This commit is contained in:
Dander7BD 2014-02-04 16:33:52 +01:00
parent 1952ff9aba
commit 68dc5be9cb
2 changed files with 2 additions and 0 deletions

View File

@ -332,6 +332,7 @@ UpdateState SimpleRigidBody::Update( Float timeStepLength )
this->rigid.centerPos = Lerp( this->collisionRebound.previousSpatial.center, this->rigid.centerPos, this->collisionRebound.timeOfContact );
this->rigid.SetRotation( Lerp(this->collisionRebound.previousSpatial.axis, this->rigid.axis, this->collisionRebound.timeOfContact) );
this->rigid.boundingReach = Lerp( this->collisionRebound.previousSpatial.reach, this->rigid.boundingReach, this->collisionRebound.timeOfContact );
timeStepLength *= 2.0f - this->collisionRebound.timeOfContact; // compensate for rebounded time
this->collisionRebound.timeOfContact = 1.0f;
}

View File

@ -254,6 +254,7 @@ UpdateState SphericalRigidBody::Update( Float timeStepLength )
this->rigid.centerPos = Lerp( this->collisionRebound.previousSpatial.center, this->rigid.centerPos, this->collisionRebound.timeOfContact );
this->rigid.SetRotation( Lerp(this->collisionRebound.previousSpatial.axis, this->rigid.axis, this->collisionRebound.timeOfContact) );
this->rigid.boundingReach = Lerp( this->collisionRebound.previousSpatial.reach, this->rigid.boundingReach, this->collisionRebound.timeOfContact );
timeStepLength *= 2.0f - this->collisionRebound.timeOfContact; // compensate for rebounded time
this->collisionRebound.timeOfContact = 1.0f;
}