I’m making a car to follow a spline. Simple…find closest location to car’s forward vector*500.
The problem is…if the car doesn’t make it and makes a U-turn, it often starts following the spline in a wrong direction. I’d like to limit the closest locations to only following locations, not previous.
I came up with a solution but there’s not a function it requires and I have no idea how to make it differently.
Red curve - the “passed” part of the spline
Green curve - the part of spline which is still to be riden
F - the closest location at the spline
R - historically the most advanced closest location at the spline
If (F > R) then R = F
Currently the car follows the F (which leads to riding the spline in the wrong direction)
And I want it to make R which only advances to let the car follow it.
I’ll be grateful for a solution
PS: I hope my explanation is understandable, my abilities to explain suck today.