mirror of
https://github.com/APercy/automobiles_pck
synced 2025-08-16 18:05:49 +02:00
improvings
This commit is contained in:
parent
a76deabfed
commit
0e3e043c8a
@ -50,12 +50,6 @@ function automobiles_lib.physics(self)
|
|||||||
else
|
else
|
||||||
self.isinliquid = false
|
self.isinliquid = false
|
||||||
new_velocity = vector.multiply(last_accel,self.dtime)
|
new_velocity = vector.multiply(last_accel,self.dtime)
|
||||||
--[[if last_accel then
|
|
||||||
last_accel.y = last_accel.y + (automobiles_lib.gravity*-1) --gravity here
|
|
||||||
|
|
||||||
new_velocity = vector.multiply(last_accel,self.dtime)
|
|
||||||
end]]--
|
|
||||||
--self.object:set_acceleration({x=0,y=new_accel.y, z=0})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.isonground and not self.isinliquid then
|
if self.isonground and not self.isinliquid then
|
||||||
@ -87,25 +81,14 @@ function automobiles_lib.physics(self)
|
|||||||
new_velocity = vnew
|
new_velocity = vnew
|
||||||
end
|
end
|
||||||
|
|
||||||
--damage if the friction is below .97
|
--fix bug with unexpected moving
|
||||||
if self._last_longit_speed then
|
|
||||||
if friction <= 0.97 and self._last_longit_speed > 0 then
|
|
||||||
self.hp_max = self.hp_max - 0.001
|
|
||||||
automobiles_lib.setText(self, self._vehicle_name)
|
|
||||||
end --damage the plane if it have hard friction
|
|
||||||
end
|
|
||||||
|
|
||||||
--self.object:set_velocity(new_velocity)
|
|
||||||
--new_velocity = vector.subtract(new_velocity,vel)
|
|
||||||
|
|
||||||
--fix bug with unexpe3cted moving
|
|
||||||
if not self.driver_name and math.abs(vel.x) < 0.2 and math.abs(vel.z) < 0.2 then
|
if not self.driver_name and math.abs(vel.x) < 0.2 and math.abs(vel.z) < 0.2 then
|
||||||
self.object:set_velocity({x=0,y=automobiles_lib.gravity*(-1)*self.dtime,z=0})
|
self.object:set_velocity({x=0,y=automobiles_lib.gravity*(-1)*self.dtime,z=0})
|
||||||
if self.wheels then self.wheels:set_animation_frame_speed(0) end
|
if self.wheels then self.wheels:set_animation_frame_speed(0) end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.object:add_velocity(new_velocity)
|
self.object:add_velocity(new_velocity)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -404,7 +404,6 @@ function automobiles_lib.on_step(self, dtime)
|
|||||||
local accel = vector.add(longit_drag,later_drag)
|
local accel = vector.add(longit_drag,later_drag)
|
||||||
local stop = nil
|
local stop = nil
|
||||||
local curr_pos = self.object:get_pos()
|
local curr_pos = self.object:get_pos()
|
||||||
self.object:move_to(curr_pos)
|
|
||||||
|
|
||||||
if self._show_rag == true then
|
if self._show_rag == true then
|
||||||
if self._windshield_pos and self._windshield_ext_rotation then
|
if self._windshield_pos and self._windshield_ext_rotation then
|
||||||
|
Loading…
Reference in New Issue
Block a user