Improve firework direction correction math

...to allow shooting them from narrow tunnels
This commit is contained in:
the-real-herowl 2024-12-27 01:10:00 +01:00 committed by the-real-herowl
parent 4254b9311c
commit 67592d13ee

@ -56,6 +56,9 @@ local firework_entity = {
self._vl_projectile.extra = nil
end
if not self._dir then return end
if self._last_pos and (self._last_pos - self.object:get_pos()):length() < (10*dtime) then
self._rot_axis = -self._rot_axis
end
self._dir = self._dir:rotate_around_axis(self._rot_axis, dtime/3)
local obj = self.object
obj:set_velocity((obj:get_velocity():length() + self._force*dtime) * self._dir)