mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 16:10:14 +00:00
Only face target when in combat, not when selecting friendly NPCs
This commit is contained in:
parent
e234ac8d7a
commit
05870c1f03
3 changed files with 5 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue