fix smooth rotation jitters

This commit is contained in:
tenplus1 2022-10-21 11:56:54 +01:00
parent 1450b25ca4
commit c003c2e72b

12
api.lua
View File

@ -27,7 +27,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20221015",
version = "20221021",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -359,6 +359,16 @@ function mob_class:set_yaw(yaw, delay)
yaw = 0
end
-- clamp our yaw to a 360 range
if math.deg(self.object:get_yaw()) > 360 then
yaw = rad(10) ; delay = 0
elseif math.deg(self.object:get_yaw()) < 0 then
yaw = rad(350) ; delay = 0
end
delay = mob_smooth_rotate and (delay or 0) or 0
if delay == 0 then