I’m making a Mario Kart like racing game and I am having trouble determining with precison how far each racer is on the track. I have the track layout represented by a Path3D node, pathfinding is done by taking a position, finding the closest point on the curve, finding the closest node of the curve3D to that point, then making the karts look at the node adhead of that node and driving forward (Actually they look at the node 2 ahead so it’s smoother).
The problem I have is that I need to take the point that is given from the curve3D’s get_closest_point function and turn it into some sort of percentage that says how far it is along the entire curve.
I don’t need this to be 100% accurate, I just need it to be relatively accurate so that I can figure out which Karts are ahead of which other Karts. I’m not sure if there’s a function build in for that, I’m not exactly sure if the sample functions of the curve could be used. I do make myself a list of the points along the curve3D, any help would be appreciated