improved anti gravity correction

This commit is contained in:
Alexsandro Percy 2022-12-13 19:13:23 -03:00
parent 45c2159f91
commit abfdf2b153
2 changed files with 9 additions and 0 deletions

View File

@ -827,6 +827,7 @@ minetest.register_entity("automobiles_delorean:delorean", {
local turn_effect_speed = longit_speed
if turn_effect_speed > 10 then turn_effect_speed = 10 end
newroll = (-self._steering_angle/100)*(turn_effect_speed/10)
if math.abs(self._steering_angle) < 5 then newroll = 0 end
end
if newyaw~=yaw or newpitch~=pitch then self.object:set_rotation({x=newpitch,y=newyaw,z=newroll}) end

View File

@ -31,6 +31,14 @@ function delorean.gravity_auto_correction(self, dtime)
else
self._car_gravity = new_car_gravity
end
--now desacelerate
if self._car_gravity == 0 then
local curr_vel = self.object:get_velocity()
curr_vel.y = 0
self.object:set_velocity(curr_vel)
end
--minetest.chat_send_player(self.driver_name, "depois: " .. self._car_gravity)
end