Fix entity rotation (#10)

* Fix entity rotation

* Oops
This commit is contained in:
David Leal 2023-03-30 11:14:16 -06:00 committed by GitHub
parent 2aebdbc37c
commit d5ecb09738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -257,7 +257,7 @@ function lib_mount.attach(entity, player, is_passenger, passenger_number)
minetest.after(0.2, function()
player_api.set_animation(player, "sit", 30)
end)
player:set_look_horizontal(entity.object:get_yaw() + math.rad(90))
player:set_look_horizontal(entity.object:get_yaw() + math.rad(entity.player_rotation.y or 90))
end
function lib_mount.detach(player, offset)
@ -335,7 +335,7 @@ function lib_mount.drive(entity, dtime, is_mob, moving_anim, stand_anim, jump_he
if minetest.settings:get_bool("lib_mount.limited_turn_speed") then
-- WIP and may contain bugs.
local yaw = entity.object:get_yaw()
local yaw_delta = entity.driver:get_look_horizontal() - yaw + math.rad(90)
local yaw_delta = entity.driver:get_look_horizontal() - yaw + math.rad(entity.player_rotation.y or 90)
if yaw_delta > math.pi then
yaw_delta = yaw_delta - math.pi * 2
elseif yaw_delta < - math.pi then
@ -357,7 +357,7 @@ function lib_mount.drive(entity, dtime, is_mob, moving_anim, stand_anim, jump_he
entity.object:set_yaw(yaw + yaw_sign*yaw_speed)
else
entity.object:set_yaw(entity.driver:get_look_horizontal() + math.rad(90))
entity.object:set_yaw(entity.driver:get_look_horizontal() + math.rad(entity.player_rotation.y or 90))
end
end
if ctrl.jump then