Momentum "fall-off" added

Temporary till real fluid drag is implemented.
This commit is contained in:
Robin Engman 2014-02-03 11:10:04 +01:00
parent 50d895d37c
commit b8e6b83148
1 changed files with 4 additions and 0 deletions

View File

@ -49,6 +49,10 @@ void RigidBody::Update_LeapFrog( Float updateFrameLength )
{ // by Dan Andersson: Euler leap frog update when Runga Kutta is not needed
// updating the linear
//Decrease momentum with 1% as "fall-off"
//! HACK: @todo Add real solution with fluid drag
this->momentum_Linear = this->momentum_Linear*0.99f;
this->momentum_Angular = this->momentum_Angular*0.99f;
// ds = dt * Formula::LinearVelocity( m, avg_G ) = dt * avg_G / m = (dt / m) * avg_G
Float3 deltaPos = ( updateFrameLength / this->mass ) * AverageWithDelta( this->momentum_Linear, this->impulse_Linear );
if( deltaPos.GetLength() < 0.001f )