Fix extreme frame drop when running into certain corners (Fixes #2023)

pull/445/head
scrawl 10 years ago
parent d387c207d1
commit cef72385d4

@ -350,6 +350,8 @@ namespace MWWorld
velocity *= 1.f-(fStromWalkMult * (angle.valueDegrees()/180.f));
}
Ogre::Vector3 origVelocity = velocity;
Ogre::Vector3 newPosition = position;
/*
* A loop to find newPosition using tracer, if successful different from the starting position.
@ -427,10 +429,18 @@ namespace MWWorld
else
{
// Can't move this way, try to find another spot along the plane
Ogre::Real movelen = velocity.normalise();
Ogre::Vector3 direction = velocity;
Ogre::Real movelen = direction.normalise();
Ogre::Vector3 reflectdir = velocity.reflect(tracer.mPlaneNormal);
reflectdir.normalise();
velocity = slide(reflectdir, tracer.mPlaneNormal)*movelen;
Ogre::Vector3 newVelocity = slide(reflectdir, tracer.mPlaneNormal)*movelen;
if ((newVelocity-velocity).squaredLength() < 0.01)
break;
if (velocity.dotProduct(origVelocity) <= 0.f)
break;
velocity = newVelocity;
// Do not allow sliding upward if there is gravity. Stepping will have taken
// care of that.

Loading…
Cancel
Save