Only face target when in combat, not when selecting friendly NPCs

This commit is contained in:
Kelsi 2026-02-07 13:56:58 -08:00
parent e234ac8d7a
commit 05870c1f03
3 changed files with 5 additions and 3 deletions

View file

@ -872,12 +872,11 @@ void Renderer::update(float deltaTime) {
// Movement-facing comes from camera controller and is decoupled from LMB orbit.
if (cameraController->isMoving() || cameraController->isRightMouseHeld()) {
characterYaw = cameraController->getFacingYaw();
} else if (targetPosition && !emoteActive && !cameraController->isMoving()) {
// Face target when idle
} else if (inCombat_ && targetPosition && !emoteActive) {
// Face target when in combat and idle
glm::vec3 toTarget = *targetPosition - characterPosition;
if (glm::length(glm::vec2(toTarget.x, toTarget.y)) > 0.1f) {
float targetYaw = glm::degrees(std::atan2(toTarget.y, toTarget.x));
// Smooth rotation toward target
float diff = targetYaw - characterYaw;
while (diff > 180.0f) diff -= 360.0f;
while (diff < -180.0f) diff += 360.0f;