How to predict falling off edge of SM?

Hey guys,

I would like to be able to predict when my character will fall off the edge of a static mesh.

I have an animation called “Jump From ledge” animation. This animation shows the character leaping off the edge of a mesh and then transitioning into the “Falling” animation and then landing.

View image:
View Video:

This developer does it in his youtube video however he had programmed this in Unity.

I’m fairly familiar with the anim blueprint but cannot, for the life of me, think of a condition between the walking state into the ‘jump off ledge’ animation. If I use the “isFalling” boolean it plays the animation too late. So the character appears it is jumping off a ledge whilst already falling.

Any thoughts/ideas of how I could achieve this USING BLUEPRINTS. I cannot program in C++ :frowning:
I love crisp smooth animation and would like to achieve this. :slight_smile:

Below is how you do it on AnimBP. I used the ThirdPerson template and add the Jump From Ledge anim state:

  1. From ThirdPersonCharacter blueprint:
  • Add IsJumping boolean variable

  • Implement OnJumped event of CharacterMovementComponent

  • Implement OnLanded event of CharacterMovementComponent

  • Together with CharacterMovementComponent’s IsFalling check, we can differentiate falling from ledge vs falling after jump.

  1. From AnimBP Event Graph:
  • Create IsJumping? variable. This is a counterpart variable from IsJumping from the character blueprint

  • At the end of existing anim event graph, add CastToThirdPersonCharacter node, then get its IsJumping variable to set AnimBP’s IsJumping? counterpart variable

  1. From AnimBP AnimGraph → Default
  • Expand the existing AnimGraph

  • Add Conduit conduit node. Conduit lets you branch out to multiple node with similar transtition.

  • Add FallOfLedge state. Set animation to your Fall Off Ledge animation.

  • Connect Idle/Run into Conduit conduit (transition = IsInAir?)

  • Connect Conduit into JumpStart state (transition = IsJumping?)

  • Connect Conduit into FallOfLedge state (transition = NOT IsJumping?)

  • Connect FallOfLedge into Idle/Run state (transition = Time Remaining (ratio) < 0.2)

That should do it. Your Jump and FallOffLedge animation should play properly apart from each other.

First off, Thank you so much Chyros for assisting me within such a quick time and in such a detailed and clear manor! Really appreciate it.

So I have completed anim graph as per your suggestion with the conduit node (which I had no idea even existed so I’ve learnt about that [ thanks :slight_smile: ] ), not sure if I had put the correct transition rule IN the conduit node itself but here is the graph.

Whilst this does function as intended. It appears due to the animation, it cannot be smoothly completed using the anim graph. perhaps I need traces that fire off in front of the character, that way certain booleans can be checked to allow for better conditions in the animBP.

By the time the character is falling the animation is played too late. It needs to be played before the character has fallen, it seems. Here is a video to the result of your suggestion:

Any thoughts?

Once again, thank you for your time and help :slight_smile:

I didn’t know this until I searched the code. Try reverting your AnimGraph the way it was before (without the conduit) and introduce a new variable IsWalkingOffLedge. And then in your WolfBP, there’s an event called Event On Walking Off Ledge (dummy me), and then set your AnimBP’s IsWalkingOffLedge value based on it and then just reset afterwards.

I’ll try this on my end as well using the PolyArt Wolf project.

Here it is and it looks right:

My character blueprint WolfBP

268121-h-01-wolfbp-onwalkingoffledge.png

My AnimBP Wolf_AnimBP event graph:

My AnimBP Wolf_AnimBP anim graph:

My Mesh and CapsuleComponent location and size setup.

268125-h-04-wolfbp-capsulecomponent.png

Below is how it is in action: https://youtu.be/GLEl1CoKJqA

Still need a bit tweaking but I think its close to what you need.

Addendum: I think it would look and feel better to animate this using RootMotion enabled. This way, the animation would drive the CapsuleComponent movement when walking off ledge and landing after. Here’s more info about using Root Motion.

EDIT: Here’s in action using RootMotion enabled from everything: https://youtu.be/_PCj3BHtOjo