1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:23:53 +00:00

Added proper slow fall effect mechanics.

This commit is contained in:
Evgenii Babinets 2014-11-10 02:42:44 -05:00
parent de3a26e21b
commit fe385214e4

View file

@ -472,10 +472,9 @@ namespace MWWorld
physicActor->setInertialForce(Ogre::Vector3(0.0f));
else
{
float diff = time*-627.2f;
inertia.z += time * -627.2f;
if (inertia.z < 0)
diff *= slowFall;
inertia.z += diff;
inertia.z *= slowFall;
physicActor->setInertialForce(inertia);
}
physicActor->setOnGround(isOnGround);
@ -865,8 +864,8 @@ namespace MWWorld
continue;
physicActor->setCanWaterWalk(waterCollision);
// 100 points of slowfall reduce gravity by 90% (this is just a guess)
float slowFall = 1-std::min(std::max(0.f, (effects.get(ESM::MagicEffect::SlowFall).getMagnitude() / 100.f) * 0.9f), 0.9f);
// Slow fall reduces fall speed by a factor of (effect magnitude / 200)
float slowFall = 1.f - std::max(0.f, std::min(1.f, effects.get(ESM::MagicEffect::SlowFall).getMagnitude() * 0.005f));
Ogre::Vector3 newpos = MovementSolver::move(iter->first, iter->second, mTimeAccum,
world->isFlying(iter->first),