forked from teamnwah/openmw-tes3coop
Fix broken onGround status when levitating
This commit is contained in:
parent
829a7bfd1b
commit
39bc11681e
1 changed files with 5 additions and 8 deletions
|
@ -309,9 +309,6 @@ namespace MWWorld
|
||||||
*/
|
*/
|
||||||
|
|
||||||
OEngine::Physic::ActorTracer tracer;
|
OEngine::Physic::ActorTracer tracer;
|
||||||
bool isOnGround = physicActor->getOnGround();
|
|
||||||
if (movement.z > 0.f)
|
|
||||||
isOnGround = false;
|
|
||||||
Ogre::Vector3 inertia(0.0f);
|
Ogre::Vector3 inertia(0.0f);
|
||||||
Ogre::Vector3 velocity;
|
Ogre::Vector3 velocity;
|
||||||
|
|
||||||
|
@ -428,8 +425,6 @@ namespace MWWorld
|
||||||
if((ptr.getClass().canSwim(ptr) && !ptr.getClass().canWalk(ptr))
|
if((ptr.getClass().canSwim(ptr) && !ptr.getClass().canWalk(ptr))
|
||||||
&& newPosition.z > (waterlevel - halfExtents.z * 0.5))
|
&& newPosition.z > (waterlevel - halfExtents.z * 0.5))
|
||||||
newPosition = oldPosition;
|
newPosition = oldPosition;
|
||||||
else // Only on the ground if there's gravity
|
|
||||||
isOnGround = !(newPosition.z < waterlevel || isFlying);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -446,10 +441,11 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(inertia.z > 0.f) && !(newPosition.z < waterlevel || isFlying))
|
bool isOnGround = false;
|
||||||
|
if (!(inertia.z > 0.f) && !(newPosition.z < waterlevel))
|
||||||
{
|
{
|
||||||
Ogre::Vector3 from = newPosition;
|
Ogre::Vector3 from = newPosition;
|
||||||
Ogre::Vector3 to = newPosition - (isOnGround ?
|
Ogre::Vector3 to = newPosition - (physicActor->getOnGround() ?
|
||||||
Ogre::Vector3(0,0,sStepSize+2.f) : Ogre::Vector3(0,0,2.f));
|
Ogre::Vector3(0,0,sStepSize+2.f) : Ogre::Vector3(0,0,2.f));
|
||||||
tracer.doTrace(colobj, from, to, engine);
|
tracer.doTrace(colobj, from, to, engine);
|
||||||
if(tracer.mFraction < 1.0f && getSlope(tracer.mPlaneNormal) <= sMaxSlope)
|
if(tracer.mFraction < 1.0f && getSlope(tracer.mPlaneNormal) <= sMaxSlope)
|
||||||
|
@ -462,6 +458,7 @@ namespace MWWorld
|
||||||
if (standingOn->getBroadphaseHandle()->m_collisionFilterGroup == OEngine::Physic::CollisionType_Water)
|
if (standingOn->getBroadphaseHandle()->m_collisionFilterGroup == OEngine::Physic::CollisionType_Water)
|
||||||
physicActor->setWalkingOnWater(true);
|
physicActor->setWalkingOnWater(true);
|
||||||
|
|
||||||
|
if (!isFlying)
|
||||||
newPosition.z = tracer.mEndPos.z + 1.0f;
|
newPosition.z = tracer.mEndPos.z + 1.0f;
|
||||||
|
|
||||||
isOnGround = true;
|
isOnGround = true;
|
||||||
|
|
Loading…
Reference in a new issue