Back off slightly when we are touching something.

This can reduce the amount of movement solver failures significantly.
I've observed a drop of 8 iteration cases by almost factor of ten.
0.6.3
logzero 8 years ago
parent 00f3bfba27
commit a5360483bb

@ -395,6 +395,13 @@ namespace MWPhysics
break;
}
// We are touching something.
if (tracer.mFraction < 1E-9f)
{
// Try to separate by backing off slighly to unstuck the solver
const osg::Vec3f backOff = (newPosition - tracer.mHitPoint) * 1E-3f;
newPosition += backOff;
}
// We hit something. Check if we can step up.
float hitHeight = tracer.mHitPoint.z() - tracer.mEndPos.z() + halfExtents.z();

Loading…
Cancel
Save