Skip to content

fix: scale animation playback rate with entity height (fixes SDK #27)#19

Open
cryptochris8 wants to merge 1 commit intohytopiagg:mainfrom
cryptochris8:fix/animation-scale-compensation
Open

fix: scale animation playback rate with entity height (fixes SDK #27)#19
cryptochris8 wants to merge 1 commit intohytopiagg:mainfrom
cryptochris8:fix/animation-scale-compensation

Conversation

@cryptochris8
Copy link
Copy Markdown

Summary

Fixes SDK issue #27 — walking animations breaking at non-default entity scales.

The physics colliders in DefaultPlayerEntityController correctly scale with entity.height / BASE_ENTITY_HEIGHT, but animation playback rates and audio were hardcoded. This caused a visible mismatch where scaled entities' legs would slide along the ground because the animation played at the wrong speed relative to actual movement.

Fix: Multiplies animation playback rate by entity.height / BASE_ENTITY_HEIGHT for walk, run, and swim animations. Also scales footstep audio playback rate. At the default scale (height = 1.5), the multiplier is exactly 1.0, so behavior is unchanged.

Files changed: server/src/worlds/entities/controllers/DefaultPlayerEntityController.ts

Test plan

  • Create DefaultPlayerEntity at default scale — animations should look identical to before
  • Create DefaultPlayerEntity at scale 0.5 — walk animation should be slower, matching movement
  • Create DefaultPlayerEntity at scale 2.0 — walk animation should be faster, matching movement
  • Verify swim animations also scale correctly

🤖 Generated with Claude Code

…piagg#27)

Walking, running, and swimming animation playback rates now scale
proportionally with entity.height / BASE_ENTITY_HEIGHT. Previously,
animations played at a fixed speed regardless of entity scale, causing
a visual mismatch where scaled entities appeared to slide or their
legs moved at the wrong speed relative to their movement.

The audio step playback rate is also scaled to stay in sync with the
visual animation. At the default scale (1.0 / height 1.5), behavior
is unchanged since the multiplier equals 1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant