now it actually works!
This commit is contained in:
parent
84a803b828
commit
54426be303
@ -177,10 +177,10 @@ function constraints:constrain(s, want)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function brake_dist(v0, brake_max)
|
function brake_dist(v0, brake_max)
|
||||||
local tri_frames = v0\brake_max
|
local tri_frames = abs(v0\brake_max)
|
||||||
local chunks = tri_frames * (tri_frames - 1) >> 1
|
local chunks = tri_frames * (tri_frames - 1) >> 1
|
||||||
local chunk_zone = chunks * brake_max
|
local chunk_zone = chunks * brake_max
|
||||||
local overage = v0 - tri_frames * brake_max
|
local overage = abs(v0) - tri_frames * brake_max
|
||||||
return (chunk_zone + overage * (tri_frames + 1)) * sgn(v0), (overage > 0) and tri_frames + 1 or tri_frames
|
return (chunk_zone + overage * (tri_frames + 1)) * sgn(v0), (overage > 0) and tri_frames + 1 or tri_frames
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user