1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-21 22:39:39 +00:00

Continually add bits of input velocity to inertia when falling

This commit is contained in:
Chris Robinson 2013-08-20 02:10:18 -07:00
parent cf6e3ab933
commit a17997a973

View file

@ -142,13 +142,12 @@ namespace MWWorld
else else
{ {
velocity = Ogre::Quaternion(Ogre::Radian(-refpos.rot[2]), Ogre::Vector3::UNIT_Z) * movement; velocity = Ogre::Quaternion(Ogre::Radian(-refpos.rot[2]), Ogre::Vector3::UNIT_Z) * movement;
if(physicActor->getOnGround()) if(!physicActor->getOnGround())
inertia = velocity;
else
{ {
inertia = physicActor->getInertialForce(); // If falling, add part of the incoming velocity with the current inertia
velocity += inertia; velocity = velocity*time + physicActor->getInertialForce();
} }
inertia = velocity;
if(!(movement.z > 0.0f)) if(!(movement.z > 0.0f))
{ {
@ -214,7 +213,7 @@ namespace MWWorld
physicActor->setInertialForce(Ogre::Vector3(0.0f)); physicActor->setInertialForce(Ogre::Vector3(0.0f));
else else
{ {
inertia.z -= time*627.2f; inertia.z += time*-627.2f;
physicActor->setInertialForce(inertia); physicActor->setInertialForce(inertia);
} }
physicActor->setOnGround(isOnGround); physicActor->setOnGround(isOnGround);