1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 20:23:54 +00:00

Fix vec.z being applied while not in the air

This commit is contained in:
Chris Robinson 2013-05-14 23:03:28 -07:00
parent 3c5c10144a
commit b459a010b0

View file

@ -268,7 +268,9 @@ void CharacterController::update(float duration, Movement &movement)
/* FIXME: The state should be set to Jump, and X/Y movement should be disallowed except /* FIXME: The state should be set to Jump, and X/Y movement should be disallowed except
* for the initial thrust (which would be carried by "physics" until landing). */ * for the initial thrust (which would be carried by "physics" until landing). */
if(onground && vec.z > 0.0f) if(!onground)
vec.z = 0.0f;
else if(vec.z > 0.0f)
{ {
float z = cls.getJump(mPtr); float z = cls.getJump(mPtr);
@ -331,12 +333,14 @@ void CharacterController::update(float duration, Movement &movement)
else if(getState() != CharState_SpecialIdle) else if(getState() != CharState_SpecialIdle)
setState((inwater ? CharState_IdleSwim : (sneak ? CharState_IdleSneak : CharState_Idle))); setState((inwater ? CharState_IdleSwim : (sneak ? CharState_IdleSneak : CharState_Idle)));
movement.mPosition[0] += vec.x * duration; vec *= duration;
movement.mPosition[1] += vec.y * duration; movement.mPosition[0] += vec.x;
movement.mPosition[2] += vec.z * duration; movement.mPosition[1] += vec.y;
movement.mRotation[0] += rot.x * duration; movement.mPosition[2] += vec.z;
movement.mRotation[1] += rot.y * duration; rot *= duration;
movement.mRotation[2] += rot.z * duration; movement.mRotation[0] += rot.x;
movement.mRotation[1] += rot.y;
movement.mRotation[2] += rot.z;
if(mPtr.getTypeName() == typeid(ESM::NPC).name()) if(mPtr.getTypeName() == typeid(ESM::NPC).name())
{ {