Language:
Page Info
Skill Level:
Engine Version:

4.2 - Setting up your Event Graph

Choose your OS:

During this step, we're going to edit the animation's Event Graph to ensure that our animation transition variables are firing properly while the game is running.

Updating your State Variables

  1. Open the event graph by double-clicking on EventGraph in the My Blueprint tab.

    OpenEventGraph.png

  2. Right-click in the graph to bring up the Context Menu.

  3. Type "Update" in the Context Menu search field, then click on the Event Blueprint Update Animation to add that node.

    The Event Blueprint Update Animation node allows us to update our state variables every time the Animation updates so that they are always in sync with the game state.
    EventBlueprintUpdateAnimationNode.png

  4. Right-click in the graph to bring up the Context Menu.

  5. Type "Owner" in the Context Menu search field, then click on Try Get Pawn Owner to add that node.

    TryGetPawnOwnerBP_Node.png

  6. Draw off the output pin and select Cast to Character from the Context Menu.

    CastToCharacterContextMenu.png

  7. Wire the output execution pin on the Event Blueprint Update Animation to the input execution pin on Cast to Character.

    ConnectedCastToCharacterNode.png

  8. Drag off the As Character output pin and select Get Character Movement.

    GetCharacterMovementNode.png

  9. Drag off the Character Movement output pin and select Get Movement Mode.

    GetMovementMode.png

Querying Character Movement

  1. Draff off the Movement Mode output pin and select Equal (Enum).

    EqualEnumNode.png

Determining if the Character is Falling

  1. Set the dropdown value on the Equal (Enum) node to Falling.

    ConnectedIsFalling.png

  2. Alt-click on IsFalling in the My Blueprint tab and drag into the graph to create a Set Is Falling node.

    IsFalling.png

  3. Connect the unlabeled output execution pin of the Cast to Character node to the input execution pin of the Set Is Falling node and connect the output Boolean data pin of the Equal (Enum) node to the input Boolean data pin of the Set Is Falling node.

    ConnectedIsFalling.png

Determining if the Character is Running

  1. Go back to the Cast To Character node and drag off the As Character pin again. This time, select the Get Velocity node.

    GetVelocityNode.png

  2. If the character is not standing still, the length of its velocity vector will be greater than zero. So, drag off the Return Value vector output pin and select Vector Length to add that node to the graph.

    VectorLength.png

  3. Drag off the Return Value float output pin and select the > (float) node.

    GreaterThan.png

  4. Alt-click on IsRunning in the My Blueprint tab and drag into the graph to create a Set Is Running node.

    IsRunning.png

  5. Connect the output execution pin of the Set Is Falling node to the input execution pin of the Set Is Running node and connect the output Boolean pin to the > (float) node to the input Boolean pin of the Set Is Running node.

    ConnectedIsRunning.png

  6. Your Event Graph should now look like the following:

    Click on the image to zoom in.