improved support for any other game on camera reposition method

This commit is contained in:
Alexsandro Percy 2023-08-19 11:27:40 -03:00
parent 57937e7b18
commit aa2f00212e

View file

@ -751,8 +751,8 @@ function airutils.get_xz_from_hipotenuse(orig_x, orig_z, yaw, distance)
end end
function airutils.camera_reposition(player, pitch, roll) function airutils.camera_reposition(player, pitch, roll)
local new_eye_offset = vector.new() local new_eye_offset = player:get_eye_offset()
if airutils.is_minetest then
if roll < -0.4 then roll = -0.4 end if roll < -0.4 then roll = -0.4 end
if roll > 0.4 then roll = 0.4 end if roll > 0.4 then roll = 0.4 end
@ -773,8 +773,7 @@ function airutils.camera_reposition(player, pitch, roll)
new_eye_offset.y = y*1.5 new_eye_offset.y = y*1.5
local x, _ = airutils.get_xz_from_hipotenuse(0, eye_y, roll, player_properties.eye_height) local x, _ = airutils.get_xz_from_hipotenuse(0, eye_y, roll, player_properties.eye_height)
new_eye_offset.x = -x*15 new_eye_offset.x = -x*15
return new_eye_offset
end
return new_eye_offset return new_eye_offset
end end