forked from mirror/openmw-tes3mp
Use tracer hit height to skip stepping up in movement solver.
This commit is contained in:
parent
ab1724d3db
commit
00f3bfba27
3 changed files with 12 additions and 3 deletions
|
@ -396,10 +396,16 @@ namespace MWPhysics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// We hit something. Check if we can step up.
|
||||||
|
float hitHeight = tracer.mHitPoint.z() - tracer.mEndPos.z() + halfExtents.z();
|
||||||
osg::Vec3f oldPosition = newPosition;
|
osg::Vec3f oldPosition = newPosition;
|
||||||
// We hit something. Try to step up onto it. (NOTE: stepMove does not allow stepping over)
|
bool result = false;
|
||||||
// NOTE: stepMove modifies newPosition if successful
|
if (hitHeight < sStepSizeUp)
|
||||||
bool result = stepper.step(newPosition, velocity*remainingTime, remainingTime);
|
{
|
||||||
|
// Try to step up onto it.
|
||||||
|
// NOTE: stepMove does not allow stepping over, modifies newPosition if successful
|
||||||
|
result = stepper.step(newPosition, velocity*remainingTime, remainingTime);
|
||||||
|
}
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
// don't let pure water creatures move out of water after stepMove
|
// don't let pure water creatures move out of water after stepMove
|
||||||
|
|
|
@ -78,6 +78,7 @@ void ActorTracer::doTrace(const btCollisionObject *actor, const osg::Vec3f& star
|
||||||
mFraction = newTraceCallback.m_closestHitFraction;
|
mFraction = newTraceCallback.m_closestHitFraction;
|
||||||
mPlaneNormal = osg::Vec3f(tracehitnormal.x(), tracehitnormal.y(), tracehitnormal.z());
|
mPlaneNormal = osg::Vec3f(tracehitnormal.x(), tracehitnormal.y(), tracehitnormal.z());
|
||||||
mEndPos = (end-start)*mFraction + start;
|
mEndPos = (end-start)*mFraction + start;
|
||||||
|
mHitPoint = toOsg(newTraceCallback.m_hitPointWorld);
|
||||||
mHitObject = newTraceCallback.m_hitCollisionObject;
|
mHitObject = newTraceCallback.m_hitCollisionObject;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -85,6 +86,7 @@ void ActorTracer::doTrace(const btCollisionObject *actor, const osg::Vec3f& star
|
||||||
mEndPos = end;
|
mEndPos = end;
|
||||||
mPlaneNormal = osg::Vec3f(0.0f, 0.0f, 1.0f);
|
mPlaneNormal = osg::Vec3f(0.0f, 0.0f, 1.0f);
|
||||||
mFraction = 1.0f;
|
mFraction = 1.0f;
|
||||||
|
mHitPoint = end;
|
||||||
mHitObject = NULL;
|
mHitObject = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace MWPhysics
|
||||||
{
|
{
|
||||||
osg::Vec3f mEndPos;
|
osg::Vec3f mEndPos;
|
||||||
osg::Vec3f mPlaneNormal;
|
osg::Vec3f mPlaneNormal;
|
||||||
|
osg::Vec3f mHitPoint;
|
||||||
const btCollisionObject* mHitObject;
|
const btCollisionObject* mHitObject;
|
||||||
|
|
||||||
float mFraction;
|
float mFraction;
|
||||||
|
|
Loading…
Reference in a new issue