Fix cart pitch when detached

This commit is contained in:
teknomunk 2024-10-28 21:26:44 -05:00
parent b5bd02fa4f
commit a4825a3332
2 changed files with 9 additions and 2 deletions

View File

@ -341,11 +341,12 @@ function DEFAULT_CART_DEF:on_step(dtime)
end end
end end
if not staticdata.connected_at then if not staticdata.connected_at then
do_detached_movement(self, dtime) do_detached_movement(self, dtime)
else
mod.update_cart_orientation(self)
end end
mod.update_cart_orientation(self)
end end
function DEFAULT_CART_DEF:on_death(killer) function DEFAULT_CART_DEF:on_death(killer)
kill_cart(self._staticdata, killer) kill_cart(self._staticdata, killer)

View File

@ -572,6 +572,12 @@ local function do_detached_movement(self, dtime)
return return
end end
end end
-- Reset pitch if still not attached
local rot = self.object:get_rotation()
minetest.log(vector.to_string(rot))
rot.x = 0
self.object:set_rotation(rot)
end end
--return do_movement, do_detatched_movement --return do_movement, do_detatched_movement