Fix ground drag var reference in item physics

This commit is contained in:
wallabra 2022-02-09 03:09:44 -03:00
parent 2aa565ac21
commit 4105e07670
Signed by untrusted user: Gustavo6046
GPG Key ID: 5182FABAA5E139B3
1 changed files with 5 additions and 3 deletions

View File

@ -790,9 +790,10 @@ minetest.register_entity(":__builtin:item", {
local oldvel = self.object:get_velocity() -- v is vector, vel is velocity
-- drag
newv.x = newv.x - (oldvel.x - newv.x) * item_drop_settings.fluid_drag * dtime
newv.y = newv.y - (oldvel.y - newv.y) * item_drop_settings.fluid_drag * dtime
newv.z = newv.z - (oldvel.z - newv.z) * item_drop_settings.fluid_drag * dtime
local fluid_drag = item_drop_settings.fluid_drag
newv.x = newv.x - (oldvel.x - newv.x) * fluid_drag * dtime
newv.y = newv.y - (oldvel.y - newv.y) * fluid_drag * dtime
newv.z = newv.z - (oldvel.z - newv.z) * fluid_drag * dtime
newv.y = newv.y + -0.22 -- (keep slight downward thrust from previous version of code)
-- NOTE: is there any particular reason we have this, anyway?
@ -843,6 +844,7 @@ minetest.register_entity(":__builtin:item", {
return
end
local ground_drag = item_drop_settings.ground_drag
local newvel = {
x = oldvel.x - oldvel.x * ground_drag * dtime,
y = oldvel.y,