I'm making a stability measuring game for a specific controller. In this game you try to stay on the road as well as you can. (Steering is done by weight shifting of the body in standing position.)
To measure how well player follows the road I need to make a curve that is on the exact middle of the road.
Then I need to have the shortest path (line) to said curve, so I can measure distance from the middle.
For now I have thought of a straight road solution - a constant rayCast looking for collision from the player to the plane. I could make it always look perpendicular to the plane using it's normal vector. However I have no Idea how to make that check for a Curve for example 90 degree with 5 unit radius. I would need to calculate the ray direction constantly somehow.
Straight Road with middle-Plain:
90 degree turn:
Do you know how to do that ?