From a17997a973306d3d652d20381c669f83428fe4ab Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 20 Aug 2013 02:10:18 -0700 Subject: [PATCH] Continually add bits of input velocity to inertia when falling --- apps/openmw/mwworld/physicssystem.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 48d397d31..a1d759ea8 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -142,13 +142,12 @@ namespace MWWorld else { velocity = Ogre::Quaternion(Ogre::Radian(-refpos.rot[2]), Ogre::Vector3::UNIT_Z) * movement; - if(physicActor->getOnGround()) - inertia = velocity; - else + if(!physicActor->getOnGround()) { - inertia = physicActor->getInertialForce(); - velocity += inertia; + // If falling, add part of the incoming velocity with the current inertia + velocity = velocity*time + physicActor->getInertialForce(); } + inertia = velocity; if(!(movement.z > 0.0f)) { @@ -214,7 +213,7 @@ namespace MWWorld physicActor->setInertialForce(Ogre::Vector3(0.0f)); else { - inertia.z -= time*627.2f; + inertia.z += time*-627.2f; physicActor->setInertialForce(inertia); } physicActor->setOnGround(isOnGround);