Re: [MOD 0.17] VehicleSnap

Code:

-- 0.07386350632 measured from train wagon orientation, still off very tiny bitlocal rail_est = 0.07405 -- Best estimate so far 0.07405local lockAxis = { rail_est, 0.25-rail_est, 0.25+rail_est, 0.5-rail_est, 0.5+rail_est, 0.75-rail_est, 0.75+rail_est, 1.0-rail_est }

As it seems 1:2 is triangular ratio for the odd rail pieces, but math fails on this one ever-so-slightly and i had to go with trial and error repeatedly.

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

Statistics: Posted by Egor — Fri Dec 12, 2025 9:39 pm