1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 21:29:56 +00:00

Clear the movement and rotation vector when getting them

This commit is contained in:
Chris Robinson 2013-03-31 01:56:38 -07:00
parent 7b02ec411b
commit b6f2b39a2f
2 changed files with 12 additions and 8 deletions

View file

@ -414,12 +414,22 @@ namespace MWClass
Ogre::Vector3 Npc::getMovementVector (const MWWorld::Ptr& ptr) const
{
return Ogre::Vector3(getMovementSettings(ptr).mPosition);
MWMechanics::Movement &movement = getMovementSettings(ptr);
Ogre::Vector3 vec(movement.mPosition);
movement.mPosition[0] = 0.0f;
movement.mPosition[1] = 0.0f;
movement.mPosition[2] = 0.0f;
return vec;
}
Ogre::Vector3 Npc::getRotationVector (const MWWorld::Ptr& ptr) const
{
return Ogre::Vector3(getMovementSettings(ptr).mRotation);
MWMechanics::Movement &movement = getMovementSettings(ptr);
Ogre::Vector3 vec(movement.mRotation);
movement.mRotation[0] = 0.0f;
movement.mRotation[1] = 0.0f;
movement.mRotation[2] = 0.0f;
return vec;
}
bool Npc::isEssential (const MWWorld::Ptr& ptr) const

View file

@ -288,8 +288,6 @@ namespace MWInput
triedToMove = true;
mPlayer.setLeftRight (1);
}
else
mPlayer.setLeftRight (0);
if (actionIsActive(A_MoveForward))
{
@ -303,8 +301,6 @@ namespace MWInput
mPlayer.setAutoMove (false);
mPlayer.setForwardBackward (-1);
}
else
mPlayer.setForwardBackward (0);
mPlayer.setSneak(actionIsActive(A_Sneak));
@ -313,8 +309,6 @@ namespace MWInput
mPlayer.setUpDown (1);
triedToMove = true;
}
else
mPlayer.setUpDown (0);
if (mAlwaysRunActive)
mPlayer.setRunState(!actionIsActive(A_Run));