Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: https://imgur.com/gallery/XvQyleu View Video: https://youtu.be/ULO1OZM88ak?t=141

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++ :( I love crisp smooth animation and would like to achieve this. :)

Product Version: UE 4.21
more ▼

asked Feb 09 '19 at 07:38 AM in Blueprint Scripting

avatar image

23 1 3

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

      alt text

  2. 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

      alt text

  3. 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)

      alt text

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

more ▼

answered Feb 09 '19 at 04:55 PM

avatar image

1.2k 8 4 7

avatar image SirCardo Feb 10 '19 at 12:36 AM

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 :) ] ), not sure if I had put the correct transition rule IN the conduit node itself but here is the graph.

alt text

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 :)

animgraph.png (249.6 kB)
avatar image Chyros Feb 10 '19 at 03:21 AM

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.

avatar image Chyros Feb 10 '19 at 04:25 AM

Here it is and it looks right:

My character blueprint WolfBP

alt text

My AnimBP Wolf_AnimBP event graph:

alt text

My AnimBP Wolf_AnimBP anim graph:

alt text

My Mesh and CapsuleComponent location and size setup.

alt text

avatar image Chyros Feb 10 '19 at 04:30 AM

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

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question