Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    Click image for larger version

Name:	Sockets_2.png
Views:	1
Size:	104.8 KB
ID:	1200761

    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.

    Click image for larger version

Name:	Sockets_1.png
Views:	1
Size:	87.7 KB
ID:	1200762

    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?

    #2
    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".

    Comment


      #3
      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

      Comment


        #4
        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).

        Click image for larger version

Name:	EQS_Diagram1.png
Views:	1
Size:	18.5 KB
ID:	1118784

        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.

        Comment


          #5
          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?

          Comment


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

            Comment

            Working...
            X