Re: [MOD 0.17] VehicleSnap

Why estimating the angle instead of using its exact value?
As you have noticed, it is "1:2 triangular ratio", so in Lua it may be calculated as

Code:

local rail_est = math.atan(1/2) / (2*math.pi) -- approx 0.0737918

Because when i tried with 0.07386350632 earlier vs your 0.0737918, my earlier estimate was still larger number. The value 0.07405 that i came up was definitely better at driving along the rail line in those odd angles for long periods of time. Using smaller values caused several pixels more sway.
As the value i got was directly taking a train wagon orientation from the game itself when it is on that angle rail, so it was as exact for game as it can be, and yet it was not as good in practise. Something to do with how car behaves perhaps, how its drag is calculated, rounding or whatever...
Statistics: Posted by Zaflis — Fri Dec 12, 2025 10:15 pm