diff --git a/apps/openmw/mwphysics/movementsolver.cpp b/apps/openmw/mwphysics/movementsolver.cpp index 4952a561e7..d67758a618 100644 --- a/apps/openmw/mwphysics/movementsolver.cpp +++ b/apps/openmw/mwphysics/movementsolver.cpp @@ -202,7 +202,8 @@ namespace MWPhysics for (int iterations = 0; iterations < sMaxIterations && remainingTime > 0.0001f; ++iterations) { - osg::Vec3f nextpos = newPosition + velocity * remainingTime; + osg::Vec3f diff = velocity * remainingTime; + osg::Vec3f nextpos = newPosition + diff; bool underwater = newPosition.z() < swimlevel; // If not able to fly, don't allow to swim up into the air @@ -214,7 +215,9 @@ namespace MWPhysics continue; // velocity updated, calculate nextpos again } - if ((newPosition - nextpos).length2() > std::numeric_limits::epsilon()) + // Note, we use an epsilon of 1e-6 instead of std::numeric_limits::epsilon() to avoid doing extremely + // small steps. But if we make it any larger we'll start rejecting subtle movements from e.g. idle animations. + if (diff.length2() > 1e-6 && (newPosition - nextpos).length2() > 1e-6) { // trace to where character would go if there were no obstructions tracer.doTrace(actor.mCollisionObject, newPosition, nextpos, collisionWorld, actor.mIsOnGround);