1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 20:53:50 +00:00

Fixes #1209: Tarhiel never falls

There are a few pitfalls with this code:
 - Gravity is only considered when applying queued movement. Therefore, make sure to queue some movement every frame. (Could be refactored in the future?)
 - The character controller never detects being in free fall (!World::isOnGround) unless movement has been applied.
This commit is contained in:
scrawl 2014-03-22 00:46:47 +01:00
parent 688e03a9d2
commit 394284d0f8

View file

@ -1245,12 +1245,8 @@ void CharacterController::update(float duration)
else //avoid z-rotating for knockdown
world->rotateObject(mPtr, rot.x, rot.y, 0.0f, true);
// always control actual movement by animation unless this:
// FIXME: actor falling/landing should be controlled by physics engine
if(mMovementAnimVelocity == 0.0f && (vec.length() > 0.0f || mJumpState != JumpState_None))
{
if (mMovementAnimVelocity == 0)
world->queueMovement(mPtr, vec);
}
}
movement = vec;
@ -1290,7 +1286,7 @@ void CharacterController::update(float duration)
}
// Update movement
if(moved.squaredLength() > 1.0f)
if(mMovementAnimVelocity > 0)
world->queueMovement(mPtr, moved);
}
mSkipAnim = false;