PathPoint road tracking with

project link

In this code structure, the pathpoint continues in a fixed way, but I want it as follows;
I want the camera to always follow the closest pathpoint, no matter what happens randomly, A, B, C.
How should I edit the code that way?

Hi @Ozden_Delibas,

I imagine one way to approach that is to rework the code to support multiple paths. So you have one list of points for the first fixed path and as soon as the objects reached the junction, you select one from the three available path points to continue.

I don’t have any example in mind with multiple path selection though.

1 Like

As Leonidas mentioned, the original project wasn’t designed for a dynamic path.

You would need to change it or write a completely new script that would always check what’s the closest point that is in front of the camera. This can be done with a simple distance check from the camera/current point to all the other available points.

The other issue is that that project is using curves for the path generation which is calculated at the beginning and the curve is constructed taking into account of the points behind and ahead of the current point.

If this is going to be a dynamic path, I would consider changing the behaviour so that the camera is steered by the path so you can still get the smooth movement without using curves.

Honestly, it is probably easier for you to write a new script rather than using this as a base.

1 Like