ludic.character: the look goes up and down to 89 degrees (was -55..35), and the orbit's heading holds when the camera is straight over or under the pivot; ludic.aim: aim_ahead, whether a point is before the view

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 12:14:04 +03:00
parent 765d800842
commit 0b35f810b6
3 changed files with 21 additions and 2 deletions

View file

@ -44,7 +44,8 @@ export function char_camera_third(character_st: mut CharacterState, dt: float) -
character_st.chr_eye_z = cz
let ddx = ax - cx
let ddz = az - cz
character_st.chr_eye_yaw = Math.atan2(-ddx, -ddz)
# straight over or under the pivot the offset has no heading of its own: keep the look's
if ddx * ddx + ddz * ddz > 0.0025 { character_st.chr_eye_yaw = Math.atan2(-ddx, -ddz) } else { character_st.chr_eye_yaw = character_st.chr_cam_yaw }
character_st.chr_eye_pitch = Math.atan2(character_st.chr_piv_y - cyy, Math.sqrt(ddx * ddx + ddz * ddz))
}