Download

Ideal way to set up state machines for multiple poses, ie no weapon, rifle, pistol, smg etc etc???

Hey guys,

Im new to state machines and have had a lot of fun and success setting up one for a completely idle character, ie holding no weapon.

I know I could do a simple transition with a rule based on my weapon class type and just remake all of it but with weapons but I just want to make sure I know the best way to do this.

I have read you can have state machines inside state machines but to be honest, as a beginner I dont really understand the documentation on this and I havent managed to find a tutorial directly addressing this issue.

I want to just make sure that depending on the weapon I have equipped, I will run around etc with my hands in that pose, so if I have a pistol I will have a state machine where all of the movement includes holding the pistol, same for the rifle…

I hope this makes sense and if someone has advice on how this would be set up in a game id love to hear it.

Thanks for reading and thank you very much for any help,

Kind Regards,

Joe

State Machines historically speaking has been used in video games since forever as to the need to be able to move a 3d character in 3d space so is still around today as it simply works but not all that well if there is also a need for more complex animation requirements as movement requires as close to real time interaction but the problem is when the character has to preform two state changes at the same time.

Example: The Player is running but has to preform a reload of the weapon at the same time. The problem here is of course the moment you change the locomotion state, say from a run to a walk, the state change needed for the reload is cut off due to the change of the migration path. Bottom line there is no real efficient way of being able to switch “two” needed state changes directly with in a state machine between a locomotion state change and an action state change.

To break it down a bit more.

Locomotion requires dynamic state changes as to the movement of the player as in if the state needs to change from moving back and forwards.

Or

If a movement key is no longer being pressed the player defaults to an idle state.

An action state needs to respond to the pressing of a key once to activate the state and needs to run in full unless overridden by another action state,if allowed.

This could be a reload, a punch, casting a magic spell, or any other state change that does not require the animation used for the locomotion state.

To do this you add what is called layering, as in animation layering, and is easy enough to do using the many different layering nodes that are available in UE4 for just this purpose.

So

If you have your player moving around in the desired manner consider that part done and move on to learning the different ways you can layer in the needed action states. .

Thank you very much for such an informative response, ill be sure to keep this in mind when tackling the issue! Cheers!