Creating State Machines

Choose your OS:

Before actually creating your State Machine , it is a good idea to take a little time and plan out exactly which states you will need, as well as the circumstances that will drive transitions between states. This will give you a solid plan of attack for not only the State Machine but also the variables you will need to drive it and which animations will be a part of each state.

You can create a New State Machine inside the AnimGraph of an Animation Blueprint Editor:

  1. Right-click within the AnimGraph of your Animation Blueprint and choose State Machines > New State Machine from the context menu.

    CreateNewStateMachine.png

    Generally, it is a good idea to name your State Machine immediately after creation.

  2. Right-click the new State Machine in the My Blueprint window and enter a new name in the name field.

    RenameStateMachine.png

    In this case, the State Machine has been named "Locomotion."

    LocomotionSMNode.png

  3. You can open the State Machine to define its States and Transitions by Double-clicking it.

    StateMachineEntryPoint.png

    This will open a new graph tab with nothing but an Entry point, which essentially kicks off the animation.

Creating States and Conduits

Creating a new State is similar to creating new nodes within a Blueprint.

  1. You can Right-click and create one from the context menu.

    AddState_CM.png

    You can also drag a wire into an empty portion of the graph and release the mouse, which will also expose the context menu.

    AddStateDragWire.png

  2. You can rename your States by Right-clicking the node in the graph.

    StateDefault.png

    Above our State has been created and renamed to Idle below.

    StateRenamed.png

  3. Conduits are created in a similar manner, by either Right-clicking in the graph or dragging a new wire into an empty space on the graph.

    CreateConduit.png

Creating Transition Rules

Transition Rules are created automatically along the wires that connect States and Conduits. Graphically, Transition Rules appear as a small circular directional icon, like so:

NewTransitionRule.png

This means that when you create a new State or Conduit by dragging a wire into an empty space on the graph, a Transition Rule will automatically be created for that wire. Additionally, you can drag a wire back to the original node to create a second Transition Rule for transitioning back to that node.

CreateTransition.png

You can Double-click on a Transition Rule to open a new graph that will allow you to define the success or fail conditions for the transition.

TranstionRule.png

Above if the Boolean IsSecondaryAttacking? is True, then the transition into the new state can occur.