Download

Move a character NPC through waypoints with add movement input

First of all I have a spawner actor which spawns my character NPC. The spawner also has an array of way points which I place in the world in a 3x3 square. When the NPC is spawned I generate an array of vectors to represent a bezier path through the waypoints. Up until now everything works great.

Now the problem is moving through those generated vectors. I started by simply using the


MoveTo

task in the behavior tree this works however, the movement is choppy because the character stops at each point then proceeds to the next. So I have now been trying to implement a different method for doing this by using


add movement input

like this:


splineDelta

is the length of the full bezier curve divided by character speed divided by the number of spline vectors which works out to be the total time required to traverse between points.

Now I’m obviously missing how


add movement input

functions i assumed that it needs continues updating based on tutorials I’ve seen on implementing it to deal with with character axis controls. So that’s how I’ve implemented it here in the character NPC blueprint.

I’ve also tried only firing it when i need a new direction ie increment the index.

In both these methods i just get the character twitching at the origin.

Any help with this will be greatly appreciated.