In this lesson, you will learn how to use vertical velocity to trigger the transition from a "Jumping" state to a "Falling" state within your Animation Blueprint.
Detecting Verticality
When your character jumps, they aren't just in one static "air" state. They transition from an upward impulse (the Jump Start) to a peak and then a descent (the Falling loop). To handle this smoothly, we look at the character's movement physics.
In your AnimGraph, navigate to your State Machine. You likely already have an IsFalling boolean driving your transition from "Locomotion" to "Airborne." However, to differentiate between rising and falling, we need to look at the Velocity vector.
Implementing the Transition Rule
Open the Transition Rule that leads from your "Jump Start" state to your "Falling" loop. Inside, you will access the character's movement data.
- Drag off your Try Get Pawn Owner node and cast it to your character class.
- Get the Character Movement Component.
- Use the Get Velocity node.
- Split the return value to isolate the Z-axis (which represents vertical movement).
You can then create a rule: If Velocity.Z < 0, the character is moving downward. You can wire this result into your transition rule logic to move the character into the "Falling" loop animation once the upward force of the jump has dissipated.
// Logic inside the Transition Rule node
// Return true if the character is moving downward
return Velocity.Z < 0.0f;
By checking if the velocity is negative, you ensure the animation switches to the "Falling" loop exactly when gravity takes over. This prevents the character from looking like they are hovering upward while they should be dropping back to the ground, creating a much more grounded and responsive feel to your character’s movement.
Key Takeaway: By using the Z-component of your character’s velocity to drive transition rules, you can create fluid, physics-based animation states that react naturally to the character's actual trajectory in the game world.