# How to get a spawned character (NPC) to move in the direction of forward vector.

This way whatever way their forward vector is they will move in that direction.

I think I have seen this before but forgot. It will be coming off an Event Tick. Thanks.

Hi.
There is a node in blueprints to get the actorâ€™s forward vector (getActorForwardVector)
Then you can add movement input to the charcter movement component ofor example, or if the character uses a navmesh you can use AIMoveTo and set the location using the actor location and his forward vector.

1 Like

What I am about to show you is very simple but by just adjusting either Y -1 or Y 1 can make the NPC run left or right in this configuration.

But, if it would work in forward vector, then as soon as it spawns it will run in that direction. I laid out some math nodes here but I still didnâ€™t get it. I thought it was add the actor location to the forward vector multiplied by the delta seconds but that wasnâ€™t it. I hope someone who knows the right formula sees this thread.

do you mean left / right as forward/backward?

1 Like

No like in the direction of the blue arrow / forward vector. That way it could be rotated when spawned and it will run in that direction.

1 Like

blue arrow is -y,which is leftâ€¦
So we want it to walk either left or right?

1 Like

No, the forward vector, if the character is rotated on the Z, the Y and X will be different. But you have forward vector, right vector, and up vector.

yeah.the blue arrow is forward vector of the character.but itâ€™s left vector of world.we donâ€™t have to worry about where is the characterâ€™s forward/left/right. We still can make him walk to world left/right

here is a quick example,I hope this close to what you need.

1 Like

Yes it is, thank you very much for making these pics and vid!

(post deleted by author)