I want to make an object follow a specific track with turns, curves, etc. I also want this track to be fairly wide so the player can move this object side to side.
The best way to describe it would be a race track with multiple cars. They are all following the same track, but can also move side to side, like on different lanes.
Any and all help with this would be greatly appreciated. Thanks
a common and relatively easy solution for a driving AI is to make it follow a precomputed “ideal” path. But the AI does not drive exactly on that path, but always drives directly to a point on that path that is always a certain amount ahead of it, therefore never reaching that point. The distance of that point should be far enough away from the car to avoid unnecessarily abrupt curves and the car can easily reach it considering its turn radius. But when it goes around a narrow curve, it must be close enough so the car does not get stuck in the curve, or you dynamically reduce the distance to the point on the path e.g. when an obstacle is encountered.
This way you can push the car away from the track and it will still know how to drive back. And you can implement detection of obstacles, evasion, and then resuming the behaviour of following the track. For multiple lanes, you could precompute multiple paths and make the driving AI consider switching it in case an obstacle is encountered, or even implement an evaluation of which lane is the shortest/fastest to drive on.
Of course, this kind of AI that does not use real pathfinding can get stuck between colliders and not find the way out, but traditional pathfinding does not give give results that consider the turn radius of a car.
Long shot but did you find a solution to this by any chance as I seem to have the same problem @cgraf1