mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-22 11:39:39 +00:00
Fix actor stepping
This commit is contained in:
parent
0463dc0653
commit
3843357cd2
1 changed files with 4 additions and 5 deletions
|
@ -29,7 +29,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
|
|
||||||
static const float sMaxSlope = 60.0f;
|
static const float sMaxSlope = 60.0f;
|
||||||
static const float sStepSize = 30.0f;
|
static const float sStepSize = 32.0f;
|
||||||
// Arbitrary number. To prevent infinite loops. They shouldn't happen but it's good to be prepared.
|
// Arbitrary number. To prevent infinite loops. They shouldn't happen but it's good to be prepared.
|
||||||
static const int sMaxIterations = 8;
|
static const int sMaxIterations = 8;
|
||||||
|
|
||||||
|
@ -48,16 +48,15 @@ namespace MWWorld
|
||||||
OEngine::Physic::ActorTracer tracer, stepper;
|
OEngine::Physic::ActorTracer tracer, stepper;
|
||||||
|
|
||||||
stepper.doTrace(colobj, position, position+Ogre::Vector3(0.0f,0.0f,sStepSize), engine);
|
stepper.doTrace(colobj, position, position+Ogre::Vector3(0.0f,0.0f,sStepSize), engine);
|
||||||
if(stepper.mFraction == 0.0f)
|
if(stepper.mFraction < std::numeric_limits<float>::epsilon())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
tracer.doTrace(colobj, stepper.mEndPos, stepper.mEndPos + velocity*remainingTime, engine);
|
tracer.doTrace(colobj, stepper.mEndPos, stepper.mEndPos + velocity*remainingTime, engine);
|
||||||
if(tracer.mFraction < std::numeric_limits<float>::epsilon() ||
|
if(tracer.mFraction < std::numeric_limits<float>::epsilon())
|
||||||
(tracer.mFraction < 1.0f && getSlope(tracer.mPlaneNormal) > sMaxSlope))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
stepper.doTrace(colobj, tracer.mEndPos, tracer.mEndPos-Ogre::Vector3(0.0f,0.0f,sStepSize), engine);
|
stepper.doTrace(colobj, tracer.mEndPos, tracer.mEndPos-Ogre::Vector3(0.0f,0.0f,sStepSize), engine);
|
||||||
if(getSlope(stepper.mPlaneNormal) <= sMaxSlope)
|
if(stepper.mFraction < 1.0f && getSlope(stepper.mPlaneNormal) <= sMaxSlope)
|
||||||
{
|
{
|
||||||
// only step down onto semi-horizontal surfaces. don't step down onto the side of a house or a wall.
|
// only step down onto semi-horizontal surfaces. don't step down onto the side of a house or a wall.
|
||||||
position = stepper.mEndPos;
|
position = stepper.mEndPos;
|
||||||
|
|
Loading…
Reference in a new issue