readd and use air drag function
This commit is contained in:
parent
843b920913
commit
307cac1395
13
init.lua
13
init.lua
@ -547,6 +547,17 @@ core.register_entity(":__builtin:item", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
step_air_drag_physics = function(self)
|
||||||
|
|
||||||
|
local vel = self.object:get_velocity()
|
||||||
|
|
||||||
|
-- apply air drag
|
||||||
|
if self.falling_state or (self.slippery_state and not self.waterflow_state) then
|
||||||
|
self.accel.x = self.accel.x - vel.x * air_drag
|
||||||
|
self.accel.z = self.accel.z - vel.z * air_drag
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
on_step = function(self, dtime, moveresult)
|
on_step = function(self, dtime, moveresult)
|
||||||
|
|
||||||
-- reset acceleration
|
-- reset acceleration
|
||||||
@ -575,7 +586,7 @@ core.register_entity(":__builtin:item", {
|
|||||||
self:step_water_physics()
|
self:step_water_physics()
|
||||||
self:step_ground_friction()
|
self:step_ground_friction()
|
||||||
self:step_gravity()
|
self:step_gravity()
|
||||||
|
self:step_air_drag_physics()
|
||||||
self:step_apply_forces()
|
self:step_apply_forces()
|
||||||
|
|
||||||
-- do item checks
|
-- do item checks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user