forked from teamnwah/openmw-tes3coop
Implement turning states
This commit is contained in:
parent
7611caa6eb
commit
4836ba16f7
2 changed files with 13 additions and 0 deletions
|
@ -75,6 +75,9 @@ static const struct {
|
|||
{ CharState_SneakLeft, "sneakleft" },
|
||||
{ CharState_SneakRight, "sneakright" },
|
||||
|
||||
{ CharState_TurnLeft, "turnleft" },
|
||||
{ CharState_TurnRight, "turnright" },
|
||||
|
||||
{ CharState_Jump, "jump" },
|
||||
|
||||
{ CharState_Death1, "death1" },
|
||||
|
@ -231,6 +234,13 @@ void CharacterController::update(float duration, Movement &movement)
|
|||
// Apply any sideways movement manually
|
||||
movement.mPosition[0] += vec.x * (speed*duration);
|
||||
}
|
||||
else if(rot.z != 0.0f && !inwater && !sneak)
|
||||
{
|
||||
if(rot.z > 0.0f)
|
||||
setState(CharState_TurnRight, true);
|
||||
else if(rot.z < 0.0f)
|
||||
setState(CharState_TurnLeft, true);
|
||||
}
|
||||
else if(mAnimQueue.size() == 0)
|
||||
setState((inwater ? CharState_IdleSwim : (sneak ? CharState_IdleSneak : CharState_Idle)), true);
|
||||
|
||||
|
|
|
@ -54,6 +54,9 @@ enum CharacterState {
|
|||
CharState_SneakLeft,
|
||||
CharState_SneakRight,
|
||||
|
||||
CharState_TurnLeft,
|
||||
CharState_TurnRight,
|
||||
|
||||
CharState_Jump,
|
||||
|
||||
/* Death states must be last! */
|
||||
|
|
Loading…
Reference in a new issue