How AI pass the variable value to move character to specific location

I followed a tutorial but I dont understand how the location variable value transport to another part of AI to move to this location

The target location used is variable “LocationToGo” and show 3D widget selected. I dont know how the value become available to Behavior Tree

Here is the blueprints:

Character

Character controller

Behavior tree:

Blackboard:

Any simple explanation ?

Thanks

I doubt there is a simple explanation for this. But I too would like to know how exactly the move to nodes operate.

From what I have seen, constant motion, (unless its a timeline) requires fast fire. like from an Event Tick or a Timer set on loop with a really fast rate of .1 or greater.

Apparently that node is also doing math to calculate movement directions.

If you want to experiment with how NPC’s move. A “simple” answer I would suggest is three nodes.

  1. Event Tick for fast fire

  2. Get Unit Direction Vector - Point A to a point B. Feed its output to AMI

  3. Add movement input. For example, if this is done in the NPC’s bp, and the from is get actor location and the too is the TPC location. This NPC will move to where the TPC is. So I would imagine something like what these three nodes are doing together is what a move to node is doing.

Reverse the to and from and the NPC will run from the player. But the caveat here is that you must use a character bp to have access to AMI.

This isn’t “AI” per say, but it is enemy movement behavior.

the typical way is to use the blackboard,

you can get the blackboard from the controller and SetValueAsVector

but my preferrence is to have the AITask get it from the controller pawn.
On your BTTask it’ll have an event execute which returns a pawn, then cast/interface to the pawn to get the value

1 Like

In Task I used cast to get the variable “WorldLocationToGo” then I use node called “Set Blackboard Value as Vector” . What this node mean ? set the variable value to any blackboard variable of type vector ?

Dont understand how the blacboard variable get its value

if you cast you dont need to Set the blackboard, you can just use the result.
you only need the blackboard if its a condition for one of your Task Nodes.

ie you could have a Blackboard value as Enum that decides which task to do (move, patrol, attack etc)

1 Like

I dont understand . Is there any video explain this or documentation ? I am searching now in youtube

1 Like

yeah search Behavior Tress

1 Like

I did figure out a simple NPC move to here. You can do this with just an actor BP, no character or pawn bp required.

I think I figure it out. In node “set value as vector” it has input parameter called “key name” this is the name of the variable created in the black board