mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
rendering: use Walk (anim 5) vs Run (anim 4) based on movement pace
CameraController now plays Walk (5) for backpedal/slow pace and Run (4) for forward running (runPace), matching WoW's animation convention. Also handles transitions between Walk and Run while already moving.
This commit is contained in:
parent
baaa063342
commit
279c30367a
1 changed files with 11 additions and 2 deletions
|
|
@ -1446,10 +1446,12 @@ void CameraController::update(float deltaTime) {
|
|||
bool shouldHidePlayer = isFirstPersonView() || (actualDist < MIN_DISTANCE + 0.1f);
|
||||
characterRenderer->setInstanceVisible(playerInstanceId, !shouldHidePlayer);
|
||||
|
||||
// Drive movement animation: Run (4) when moving, Stand (0) when idle.
|
||||
// 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;
|
||||
|
|
@ -1457,7 +1459,14 @@ void CameraController::update(float deltaTime) {
|
|||
playerInstanceId, curAnimId, curT, curDur);
|
||||
if (!gotState || curAnimId != 1 /*Death*/) {
|
||||
characterRenderer->playAnimation(playerInstanceId,
|
||||
nowMoving ? 4u : 0u, /*loop=*/true);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue