I am trying to make my AI move to the player as if it were going to attack him. To do so, I created a task in my behaiour tree and in this task I want to use the AI MoveTo node. However, it always fails. Can anyone help me understanding why it doesn’t succeed ?
Hi, first of I wouldn’t do this on tick, but rather on EventReceiveExecute (I don’t think you want it to restart every time the behavior tree ticks, but only when the node is executed. No idea what will happen if you do this on tick, never tried that)
Then make sure that
(-) TargetActor is valid (check that the blackboard value of “Player” is valid, either by printing, watching it in the AI debug view or in the running behavior tree)
(-) That you have a navmesh in your level that also covers the area from the AI to the player (you can press P in the editor to visualize the navmesh)
(-) That a path exists from the AI to the Player (you can use the GetPathLengthNode and check the return value Get Path Length | Unreal Engine Documentation)
By the way, is there a reason why you’re not using the build in MoveTo task?
Also here is a step by step tutorial from the docs on how to make an AI that chases the player Behavior Tree Quick Start Guide | Unreal Engine Documentation so as a last resort you could compare the steps there with what you have.