rendering: fix NPC movement animation IDs and remove redundant player anim

The renderer's CharAnimState machine already drives player character
animations (Run=5, Walk=4, Jump, Swim, etc.) — remove the conflicting
camera controller code added in the previous commit.

Fix creature movement animations to use the correct WoW M2 IDs:
4=Walk, 5=Run. Both the per-frame sync loop and the SMSG_MONSTER_MOVE
spline callback now use Run (5) for NPC movement.
This commit is contained in:
Kelsi 2026-03-10 10:19:13 -07:00
parent 279c30367a
commit 137b25f318
3 changed files with 8 additions and 30 deletions

View file

@ -226,9 +226,6 @@ private:
bool autoRunning = false;
bool tildeWasDown = false;
// Movement animation state tracking
bool prevPlayerMoving_ = false;
// Movement state tracking (for sending opcodes on state change)
bool wasMovingForward = false;
bool wasMovingBackward = false;

View file

@ -1476,7 +1476,8 @@ void Application::update(float deltaTime) {
}
posIt->second = renderPos;
// Drive movement animation: Run (4) when moving, Stand (0) when idle.
// Drive movement animation: Run (anim 5) when moving, Stand (0) when idle.
// WoW M2 animation IDs: 4=Walk, 5=Run. Use Run for all server-driven NPC movement.
// Only switch on transitions to avoid resetting animation time.
// Don't override Death (1) animation.
bool prevMoving = creatureWasMoving_[guid];
@ -1486,7 +1487,7 @@ void Application::update(float deltaTime) {
bool gotState = charRenderer->getAnimationState(instanceId, curAnimId, curT, curDur);
if (!gotState || curAnimId != 1 /*Death*/) {
charRenderer->playAnimation(instanceId,
isMovingNow ? 4u : 0u, /*loop=*/true);
isMovingNow ? 5u : 0u, /*loop=*/true);
}
}
}
@ -2453,7 +2454,8 @@ void Application::setupUICallbacks() {
glm::vec3 renderPos = core::coords::canonicalToRender(glm::vec3(x, y, z));
float durationSec = static_cast<float>(durationMs) / 1000.0f;
renderer->getCharacterRenderer()->moveInstanceTo(instanceId, renderPos, durationSec);
// Play Run animation for the duration of the spline move (anim 4).
// Play Run animation (anim 5) for the duration of the spline move.
// WoW M2 animation IDs: 4=Walk, 5=Run.
// Don't override Death animation (1). The per-frame sync loop will return to
// Stand when movement stops.
if (durationMs > 0) {
@ -2461,7 +2463,7 @@ void Application::setupUICallbacks() {
auto* cr = renderer->getCharacterRenderer();
bool gotState = cr->getAnimationState(instanceId, curAnimId, curT, curDur);
if (!gotState || curAnimId != 1 /*Death*/) {
cr->playAnimation(instanceId, 4u, /*loop=*/true);
cr->playAnimation(instanceId, 5u, /*loop=*/true);
}
if (!isPlayer) creatureWasMoving_[guid] = true;
}

View file

@ -1446,29 +1446,8 @@ void CameraController::update(float deltaTime) {
bool shouldHidePlayer = isFirstPersonView() || (actualDist < MIN_DISTANCE + 0.1f);
characterRenderer->setInstanceVisible(playerInstanceId, !shouldHidePlayer);
// Drive movement animation: Run (4) / Walk (5) when moving, Stand (0) when idle.
// Only transition on state changes to avoid resetting animation time every frame.
// Skip if current animation is Death (1) — death pose must persist.
bool nowMoving = isMoving();
// Use Run (4) when running forward; Walk (5) for backpedal or slow pace.
uint32_t movingAnim = runPace ? 4u : 5u;
if (nowMoving != prevPlayerMoving_) {
prevPlayerMoving_ = nowMoving;
uint32_t curAnimId = 0; float curT = 0.0f, curDur = 0.0f;
bool gotState = characterRenderer->getAnimationState(
playerInstanceId, curAnimId, curT, curDur);
if (!gotState || curAnimId != 1 /*Death*/) {
characterRenderer->playAnimation(playerInstanceId,
nowMoving ? movingAnim : 0u, /*loop=*/true);
}
} else if (nowMoving) {
// Also switch between Run and Walk if pace changes while moving.
uint32_t curAnimId = 0; float curT = 0.0f, curDur = 0.0f;
characterRenderer->getAnimationState(playerInstanceId, curAnimId, curT, curDur);
if (curAnimId != movingAnim && curAnimId != 1 /*Death*/) {
characterRenderer->playAnimation(playerInstanceId, movingAnim, /*loop=*/true);
}
}
// Note: the Renderer's CharAnimState machine drives player character animations
// (Run, Walk, Jump, Swim, etc.) — no additional animation driving needed here.
}
} else {
// Free-fly camera mode (original behavior)