forked from MineClone5/MineClone5
Change effect of gravity on submerged items
This commit is contained in:
parent
7be9a8a574
commit
09854a9af4
|
@ -791,6 +791,9 @@ minetest.register_entity(":__builtin:item", {
|
||||||
|
|
||||||
local oldvel = self.object:get_velocity() -- v is vector, vel is velocity
|
local oldvel = self.object:get_velocity() -- v is vector, vel is velocity
|
||||||
|
|
||||||
|
-- apply gravity *before* drag computations
|
||||||
|
oldvel.y = oldvel.y - get_gravity() * dtime
|
||||||
|
|
||||||
-- drag
|
-- drag
|
||||||
local fluid_drag = item_drop_settings.fluid_drag
|
local fluid_drag = item_drop_settings.fluid_drag
|
||||||
|
|
||||||
|
@ -804,12 +807,6 @@ minetest.register_entity(":__builtin:item", {
|
||||||
newv.x = newv.x - (oldvel.x - newv.x) * fluid_drag * dtime
|
newv.x = newv.x - (oldvel.x - newv.x) * fluid_drag * dtime
|
||||||
newv.y = newv.y - (oldvel.y - newv.y) * 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.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?
|
|
||||||
-- since fluid drag is now on, we could as well just
|
|
||||||
-- apply gravity here; drag will slow down the fall
|
|
||||||
-- realistically
|
|
||||||
|
|
||||||
self.object:set_velocity({x = oldvel.x + newv.x * dtime, y = oldvel.y + newv.y * dtime, z = oldvel.z + newv.z * dtime})
|
self.object:set_velocity({x = oldvel.x + newv.x * dtime, y = oldvel.y + newv.y * dtime, z = oldvel.z + newv.z * dtime})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue