So I have an AI character that searches for the map for certain items and then picks them up when it finds them. While it is searching, the behavior tree is driving it’s movement and the anim graph uses a simple blend space to transition between idle and waking animations.
When it finds an item, it walks up to it and then the behavior tree calls a function on the actor to tell it to pick up the item. At the moment I just instantly destroy the item and then the behavior tree continues its search.
I have now created a “pick up” animation that I want the actor to play when it picks the item up. I’m just not sure how to handle the whole process. Here is what I’m trying to do.
Actor walks up to item.
Already have this working.
Behavior tree runs PickUp task.
At the moment this calls an event on the actor passing in the item. The actor is just destroying the item… so this will need to change and maybe add some stuff to support the following steps?
Anim graph needs to transition to playing pick up animation.
Not sure how to trigger this? From behavior tree? From actor? Call an event on Anim graph? Set a variable on Anim graph?
What is the correct way?
Behavior tree needs to wait until pick up animation is complete before continuing.
At the moment the item is instantly destroyed, so the behavior tree just continues on.
How do I tell the behavior tree to wait until an animation is complete before trying to do something else? Can the Anim graph communicate with the behavior tree or vice versa?
I can’t just have it wait a fixed amount of time as the pick up animation length can vary for different actors.
At some point during the pick up animation, the item being picked up needs to be destroyed.
I think I need to use an animation notify for this, but from what I understand you can only access an animation notify from the Anim graph? So how do I destroy the picked up item from the Anim graph or is there another way?