Re: [MOD 0.17] VehicleSnap

I have fixed the problem, see my patch on github. But again, it's hard-to-understand code.

The idea is following: at the moment when car orientation get snapped, we remember the trajectory (the "ray") which the car must follow in the future.
The ray is just 3 numbers: start_x, start_y and orientation.
Later, on every tick, we check the deviation between the ray and the current car position, and make attempt to return the car back to the ray by changing car orientation.
The bigger the deviation, the stronger the correcting attempt is.
If deviation is too big (above 0.025 tiles) we give up and forget the ray.
In practice, the car path is located inside a stripe 0.01-0.02 tiles width around the ray.

So, it works, "10 km test" passed!
Statistics: Posted by Egor — Fri Dec 19, 2025 9:13 pm