This commit is contained in:
Alexsandro Percy 2022-01-27 11:54:43 -03:00
parent 9540ab62a6
commit 71d9de0649

View File

@ -63,13 +63,14 @@ function automobiles_lib.ground_get_distances(self, radius, axis_distance)
if mid_car_level then if mid_car_level then
deltaX = axis_distance/2; deltaX = axis_distance/2;
deltaY = mid_car_level.y - rear_obstacle_level.y; if mid_car_level.y ~= nil then
m = (deltaY/deltaX) deltaY = mid_car_level.y - rear_obstacle_level.y;
local midpitch = math.atan(m) m = (deltaY/deltaX)
if math.abs(math.deg(pitch) - math.deg(midpitch)) < 20 then local midpitch = math.atan(m)
pitch = pitch + ((pitch - midpitch) / 2) if math.abs(math.deg(pitch) - math.deg(midpitch)) < 20 then
pitch = pitch + ((pitch - midpitch) / 2)
end
end end
end end
else else
self._pitch = 0 self._pitch = 0