Detect falling to trigger falling animation?

Hello :slight_smile:

I’m trying to build a animation graph and state machine set-up that allows for fall detection to trigger a falling animation.

The idea is than any motion from the character that’s negative on the global Z axis would trigger a falling state.
the states I’m trying to make are “Jump initial” “Jumping loop” “Jump APEX” “Falling loop” and “Landing” Which aren’t all covered in the UE4 tutorial.

I’m looking at this video for inspiration for a more refined jumping anim graph:
[video]- YouTube

and I want all the same functions for my character (as I had already made these animations a long while ago, and I’m hoping I finally get to use them)
The main trouble I’m having in UE4 is trying to create the refined conditions that I think should cause these animations, (like “in air” bool, it isn’t specific enough to trigger the proper animations, for example)

Any help would be greatly appreciate.
Thanks :slight_smile:

Well to trigger anything the character model would need some kind of brain, behavior tree, and become a lot more environmentally aware before, during, and after a given event has occurred.

A good stating point would be one of the many IK tutorials where a trace is projected from the bottom of the feet to generate a variable to keep the feet level with the ground so the same variable could be use to determine if the player is just jumping or about to or is falling and not jumping.

Wouldn’t something like this work? The idea being that you simulate an IF branch by having two paths out of a node where one of them has to be true and are mutually exclusive. You can get the Z in the event graph of the AnimBlueprint: “Try Get Pawn Owner > Get Velocity > break vector > set Z variable from the Z axis” and then use that variable to compare things in the state machine to.

Well the logic block should work but does it?

But since you are inspired by the above Twitch cast, which by the way I have it on my links bar and have no idea how many times I’ve watched it, if you are looking to do a much more complex control systems state machines are nasty ugly and do not scale well or at all as the more complex the design becomes the the more nasty it becomes . Every game going back to the beginning has used some form of start machine and the blueprint version only adds the benefit of getting someone else to create the state and the bugs that generally show up 9 times out of 10 is caused by looping with in the state.

If you watch the video a few more times what Epic is suggesting is a 100% data driven set up where the output state can be controlled before during and after an event with out having to scale a state machine and adding counter arguments to get the state out of the loop.

Thank you for the help!

@Bohrium, Wow that’s the half I was missing, ("AnimBlueprint: "Try Get Pawn Owner ") I was doing this in the wrong graph before. This saved me from a lot of headache. Your State machine example is not too different from mine with the transition conditions. Thanks, you helped get this working!

@FrankieV, Yeah the logic works :slight_smile: Could you elaborate more on what you mean by “data driven setup” and also “scale a state machine” (I feel like I should know that one, but I don’t)

Can do better than that.

Did a blog the other day on how to set up a data driven AnimGraph

More or less you can trade a State Machine for a Bland Space but can change the state before, during or after a given event driven by the event graph,aka data driven. At least it will make things a bit more clear that it’s not best practice to try and change the state with in a State Machine.

That video was awesome! I learned a lot about the philosophy behind your methods.

I think I’m going to do some iterations on my systems to achieve something similar, because frankly (no pun intended FrankieV lol) it’s a beautiful system. I’ll probably have more questions as I attempt to make mine more variable driven.

It’s going to be long night for me (but I look forward to it!).