Download

AI Nav finding player location

Hello Guys,

I have a blueprint that on game start moves a character to the main player, but once he reaches the player, he stops. Is there a way I can update player location and have this continuously happen?

This is the setup I’m using https://www.youtube.com/watch?v=-KDazrBx6IY

There are a few more ai tutorials out there covering ai behavior and different states, maybe these can be of help, sadly I have not worked that much with AI in Unreal yet to help specificly.

Well the easiest way would be hooking it up to Tick instead of a key down event.

Have a blackboard vector for tracking player location and update it the tick event of your Behavior Tree service.

The provided MoveTo node is not good for most purposes, because it doesn’t return true until the character reaches their destination. Instead, you want to create a task that calls AIMoveTo on the character’s AIController, but then returns immediately. That will cause them to move toward the destination, but will allow your behavior tree to continue. Next pass through, it will call MoveTo with the updated location. The result will be smooth tracking toward the player.

If you’re not scared of a little C++, I wrote a Behavior Tree task called “Move Toward” that works exactly like the built-in MoveTo node, except that it returns immediately. You can find it in this thread: https://forums.unrealengine.com/showthread.php?50057-BTTask_MoveToward-Asynchronous-quot-Move-To-quot-Behavior-Tree-task&highlight=MoveTo