Fix mounted first-person camera pivot

This commit is contained in:
Kelsi 2026-02-07 20:05:07 -08:00
parent 0ebf4d1e5e
commit 5eebd805ba
3 changed files with 14 additions and 4 deletions

View file

@ -643,7 +643,8 @@ void CameraController::update(float deltaTime) {
// ===== WoW-style orbit camera =====
// Pivot point at upper chest/neck
glm::vec3 pivot = targetPos + glm::vec3(0.0f, 0.0f, PIVOT_HEIGHT);
float mountedOffset = mounted_ ? mountHeightOffset_ : 0.0f;
glm::vec3 pivot = targetPos + glm::vec3(0.0f, 0.0f, PIVOT_HEIGHT + mountedOffset);
// Camera direction from yaw/pitch (already computed as forward3D)
glm::vec3 camDir = -forward3D; // Camera looks at pivot, so it's behind
@ -1219,7 +1220,8 @@ void CameraController::reset() {
currentDistance = userTargetDistance;
collisionDistance = currentDistance;
glm::vec3 pivot = spawnPos + glm::vec3(0.0f, 0.0f, PIVOT_HEIGHT);
float mountedOffset = mounted_ ? mountHeightOffset_ : 0.0f;
glm::vec3 pivot = spawnPos + glm::vec3(0.0f, 0.0f, PIVOT_HEIGHT + mountedOffset);
glm::vec3 camDir = -forward3D;
glm::vec3 camPos = pivot + camDir * currentDistance;
smoothedCamPos = camPos;