Added proper slow fall effect mechanics.

loadfix
Evgenii Babinets 10 years ago
parent de3a26e21b
commit fe385214e4

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

Loading…
Cancel
Save