From b8e6b83148014baa487bb47b44ddd9964255a678 Mon Sep 17 00:00:00 2001 From: Robin Engman Date: Mon, 3 Feb 2014 11:10:04 +0100 Subject: [PATCH] Momentum "fall-off" added Temporary till real fluid drag is implemented. --- Code/OysterPhysics3D/RigidBody.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Code/OysterPhysics3D/RigidBody.cpp b/Code/OysterPhysics3D/RigidBody.cpp index f053e8dd..70ded863 100644 --- a/Code/OysterPhysics3D/RigidBody.cpp +++ b/Code/OysterPhysics3D/RigidBody.cpp @@ -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 )