Fix being able to move slowly when over encumbered

actorid
scrawl 12 years ago
parent dc17fa1636
commit 8bd712cc95

@ -461,6 +461,8 @@ void CharacterController::update(float duration, Movement &movement)
Ogre::Vector3 moved = mAnimation->runAnimation(duration); Ogre::Vector3 moved = mAnimation->runAnimation(duration);
// Ensure we're moving in generally the right direction // Ensure we're moving in generally the right direction
if (speed > 0.f)
{
if((movement.mPosition[0] < 0.0f && movement.mPosition[0] < moved.x*2.0f) || if((movement.mPosition[0] < 0.0f && movement.mPosition[0] < moved.x*2.0f) ||
(movement.mPosition[0] > 0.0f && movement.mPosition[0] > moved.x*2.0f)) (movement.mPosition[0] > 0.0f && movement.mPosition[0] > moved.x*2.0f))
moved.x = movement.mPosition[0]; moved.x = movement.mPosition[0];
@ -470,6 +472,7 @@ void CharacterController::update(float duration, Movement &movement)
if((movement.mPosition[2] < 0.0f && movement.mPosition[2] < moved.z*2.0f) || if((movement.mPosition[2] < 0.0f && movement.mPosition[2] < moved.z*2.0f) ||
(movement.mPosition[2] > 0.0f && movement.mPosition[2] > moved.z*2.0f)) (movement.mPosition[2] > 0.0f && movement.mPosition[2] > moved.z*2.0f))
moved.z = movement.mPosition[2]; moved.z = movement.mPosition[2];
}
movement.mPosition[0] = moved.x; movement.mPosition[0] = moved.x;
movement.mPosition[1] = moved.y; movement.mPosition[1] = moved.y;

Loading…
Cancel
Save