mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 21:49:55 +00:00
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.
This commit is contained in:
parent
00f3bfba27
commit
a5360483bb
1 changed files with 7 additions and 0 deletions
|
@ -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…
Reference in a new issue