Using a Blueprint Component as a target actor for MoveTo in Behaviour Trees.

Hey there,
I’m trying to provide an Actor for the MoveTo Task in behaviour trees. I’m using SceneComponent actors on my PlayerCharacter blueprint to provide two “attack sockets” that my AI enemies will try to move to. I set the SceneComponents as two separate Blackboard keys on EventBeginPlay in the event graph of my AI Controller.

I’m then attempting to use these keys as locations for the MoveTo Task in the behaviour tree. In the example below, it seems to skip through the MoveTo without ever trying to reach the socket.

I’ve tried reducing the Behaviour Tree so that it’s just the MoveTo with the Socket as target and it seems to fail constantly. I’ve checked to make sure the sockets are in good positions, and they seem to be reachable. Any ideas?

Have you tried EQS system? It is great for finding targets.

Add 2 vector keys, save locations of sockets (in same blueprint you set socket values). See if those vectors change during runtime. Also check casts, sometimes they do not work inside behavior tree.

Or use Visual Debugger to see values during runtime, but with AI and behavior tree it is messy.

Also make sure you have working navigation volume, press “P”.

Hey there, thanks for your response. I definitely have a working NavMesh. Thanks very much for the EQS suggestion. I’d not heard of it before and am looking into it now. My AIs have some constraints on movement that must always be considered so this is looking good :slight_smile:

Having gone through the EQS tutorial on Unreal Docs, I’ve seen something which might be of use to me but it seems quite complicated. What I really want to do is produce a generator that only gives me values in a cone forwards from the AI, as shown below (excuse my crappy PS).

My game involves motorbikes, so I need for them to be moving forwards continually. I was hoping that I could use the EQS to filter out locations that weren’t in a direct cone ahead of each AI, and use the same system to reduce bunching up.

I think I’ve found the problem with my first method (using components as moveTo destinations in the BT blackboard). When I’m requesting location of my component destinations (whether they’re scene components or spawned child actors) they always return a location that is relative to the parent. So when I tell my AI characters to MoveTo them, there is no valid world position for them to do so.

Anyone got an idea for how I could spawn/attach/use a component which can output individual world location for me to use as a MoveTo destination? I’m sure I could do something nasty where i spawn actors in the level BP and attach them to my Player character, but this seems a bit weird. Surely there’s a way to keep it all in the Player’s BP?

Create your own moveto task, and get the transform of the component, then use moveto node