Steering a Shape along a pathway

Do you want the shape to be locked to the path like a rail, and slide along it, or do you want it to be following a series of waypoints over time like a boid where it can be begin off the path and move onto it?

If you look at previous forum examples like LerpVectorsExample and LerpVectorsSimplified you will find some basic path-following objects.

Those are for objects x,y without orientation. If you wanted them to also turn, store x,y,r in the PVector, and draw the object with orientation r. Then place two nodes on the same path point like this:

0, 0, 0
100, 0, 0
100, 0, PI * 3/2.0
100, 100, PI * 3/2.0

Now the agent moves from point 0 to 1
Then turns in place to orientation 2
Then moves to point 3.

2 Likes