Rebound adjustment trial

Rebound had a strong friction-like effect. Testing to see if it works
better if applied before the leapfrog update
This commit is contained in:
Dander7BD 2014-02-04 10:23:14 +01:00
parent d4bd72bb4a
commit 9817f844ef
2 changed files with 6 additions and 6 deletions

View File

@ -333,23 +333,23 @@ UpdateState SimpleRigidBody::Update( Float timeStepLength )
// this->isForwarded = false;
//}
this->rigid.Update_LeapFrog( timeStepLength );
{ // Rebound if needed
if( this->collisionRebound.timeOfContact < 1.0f )
{
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 );
this->collisionRebound.timeOfContact = 1.0f;
}
// Update rebound data
this->collisionRebound.previousSpatial.center = this->rigid.centerPos;
this->collisionRebound.previousSpatial.axis = this->rigid.axis;
this->collisionRebound.previousSpatial.reach = this->rigid.boundingReach;
this->collisionRebound.timeOfContact = 1.0f;
}
this->rigid.Update_LeapFrog( timeStepLength );
{ // Maintain rotation resolution by keeping axis within [0, 2pi] (trigonometric methods gets faster too)
Float3 n;
::std::modf( this->rigid.axis * (0.5f / pi), n );

View File

@ -254,23 +254,23 @@ UpdateState SphericalRigidBody::Update( Float timeStepLength )
// this->isForwarded = false;
//}
this->rigid.Update_LeapFrog( timeStepLength );
{ // Rebound if needed
if( this->collisionRebound.timeOfContact < 1.0f )
{
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 );
this->collisionRebound.timeOfContact = 1.0f;
}
// Update rebound data
this->collisionRebound.previousSpatial.center = this->rigid.centerPos;
this->collisionRebound.previousSpatial.axis = this->rigid.axis;
this->collisionRebound.previousSpatial.reach = this->rigid.boundingReach;
this->collisionRebound.timeOfContact = 1.0f;
}
this->rigid.Update_LeapFrog( timeStepLength );
{ // Maintain rotation resolution by keeping axis within [0, 2pi] (trigonometric methods gets faster too)
Float3 n;
::std::modf( this->rigid.axis * (0.5f / pi), n );