AnimNotify + Behavior Tree (& Root Motion)

Clearly note I am still very new and perhaps going about this in the wrong way. Appreciate any direction! I have attempted to follow some options on the forums and youtube but most are activated on keybind and not from the Behavior Tree and I can not seem to make the corresponding connection.

I am using the Behavior Tree to do some movie-style animation scripting. Basic commands such as NPC move here, use animation, cast spell ect ect. I want to use AnimNotify events to enable the “Flying” movement mode for root motion attacks that utilize the Z axis then swap to “Walking” at the end of the animation.

Part of the problem is that AnimNotify events do not trigger from animations executed from the Behavior tree.

My Animation Blueprint setup:

91675-ue4+root+motion+bt+1.png

I am using the Mixamo Sword and Shield Jump Attack Animation to ensure the Z-Axis animations work correctly. I followed a youtube tutorial to add the root for the animation. I did this both for the Mixamo Paladin Model and the Sword and Shield Jump Attack animation. It is working properly when I enable Show > “Process Root Motion” in Persona. He continually jumps forward in a straight line. From here I do Animation Re-Targeting for other Mixamo and Infinity Blade Warrior skeletons (with the re-target manager setup properly). I setup the Sword and Shield Jump Attack Animation with these AnimNotify events:

Now I believe I have to Cast the mesh component as a variable from the Character Blueprint to my Animation Blueprint which I have done here (or so I think):

Character Blueprint:

91679-ue4+root+motion+bt+3.png

This is the basic principle of what I am working on in the Behavior Tree:

Appreciate the help and/or direction on this!

After some experimenting I created the level blueprint version of what I was trying to accomplish. I’m sure it is possible to do both but this appears to work for now. I will update if I run in to future problems as I am still testing a few components. If anyone have any suggestions on the best method or how to simplify please let me know! I tried to make it look as a clean as possible.

This is on the level blueprint:

1 - I duplicated my Character Blueprint and deleted all contents so the Event Graph is empty.

2 - I created a blank/empty AI_Controller and applied it to the duplicate. So now I am NOT using a Behavior Tree.

3 - Animation Blueprint only has the Idle_Walk_Run blend space script. See below:

He now runs for a few seconds, then does the Sword and Shield Jump Attack with Root Motion and Z-Axis enabled followed by his return to his blend space.

I am noticing a few glitches in my animation which I am working to fix. I believe it is a Root Bone problem which will be resolve through Maya, he also starts to glide slowly when the jump animation ends which I am confused by.

If you want to use variables as switches for behavior tree you need to use the blackboard. in my example, a blueprint on my AI sets visible as true on my blackboard, my tree changes its course depending on the variables and aborts current process if changed.

Try to understand how notify observer and observer aborts works, that way you can communicate through character’s blueprints, events, and even animations.

Now, i dont really recommend depending on the onPerceptionUpdate (or blueprints for behavior at all) cause the update is not actually realtime (or so it seems), but this is just an example, and i dont think it even applies for you, but still, its a way to show you how to link from outside of the tree.
Its very important that you set the observers, if you dont, it will never switch on value change, and the tree will stay stuck on that branch.

Hey would you be willing to take a look at my root motion BP setup for AI?
I’m trying to find a way to make them rotate and a certain speed but without speed driving everything, it is neglected because of controller yaw.

Root Motion with NPCs has ruined my weekend. Sadly, the Level Blueprint example above gives me a character that slides to it’s destination, while playing the animation I am shocked that there is no documentation or suitable video tutorial on how to set up root motion for an AI controlled NPC.

If anyway gets this working, lay the solution on us.

If you are sliding to your destination chances are it is an animation blend/animation blueprint problem. I would check that first.

Make sure the NPC is using the correct Animation Blueprint and the Blend is working as well!