Skip to content

Stop outgoing animations during blend to prevent jitter#599

Closed
tracygardner wants to merge 4 commits intomainfrom
claude/fix-water-map-jitter-ruGZ2
Closed

Stop outgoing animations during blend to prevent jitter#599
tracygardner wants to merge 4 commits intomainfrom
claude/fix-water-map-jitter-ruGZ2

Conversation

@tracygardner
Copy link
Copy Markdown
Contributor

@tracygardner tracygardner commented May 3, 2026

Summary

This change fixes animation blending behavior by immediately stopping outgoing animations during transitions, while maintaining visual smoothness through frozen pose snapshots.

Key Changes

  • Stop outgoing animations immediately: When blending between animations, the outgoing animation group is now stopped right away to prevent its position and bone tracks from continuing to run during the blend phase
  • Use pose snapshots for smooth transitions: Instead of relying on the live outgoing animation, a frozen pose snapshot is created and used as the blend-out source, ensuring the visual transition remains smooth despite stopping the underlying animation
  • Applied to two animation methods: The same fix is applied to both animation blending functions in the codebase (around lines 1485 and 1808)

Implementation Details

  • The outgoing animation is stopped via outgoingGroup.stop() before the blend begins
  • A pose snapshot is created using flock._createCurrentPoseGroup() which captures the current pose state
  • The snapshot is configured with _isSnapshot = true and started with full weight (1.0)
  • This approach prevents "trigger intersection jitter" that was occurring when live animations continued running during blends
  • The refactoring also simplifies the conditional logic by always attempting to create a snapshot rather than only when no outgoing group exists

https://claude.ai/code/session_01DyCmMzSbLw9z3hgiLNhW4w

Summary by CodeRabbit

  • Bug Fixes
    • Improved animation blending behavior to provide smoother transitions when switching between different animations.

claude added 3 commits May 3, 2026 17:54
When switching animations at the water edge, the immediate physics capsule
shape change (vertical → horizontal) was causing the trigger intersection
to flip, firing rapid Enter/Exit events and creating a jitter loop.

Now updateCapsuleShapeForAnimation is called in the onComplete callback of
_blendAnimationGroups when a blend is active, so the physics shape only
changes after the visual transition finishes. Immediate update is preserved
for the no-blend path.

https://claude.ai/code/session_01DyCmMzSbLw9z3hgiLNhW4w
…jitter

With blend animations, the outgoing animation (e.g. Walk) was kept running
at decreasing weight during the blend period. If that animation has position
tracks on bone transform nodes (child meshes), those meshes shift slightly
during the blend. Because the ActionManager uses isRecursive:true, child
mesh intersection is checked against the water trigger — causing spurious
Exit events mid-blend and the resulting jitter at the water edge.

Fix: stop the outgoing animation immediately when starting a blend, then
capture a frozen pose snapshot as the visual blend-out source. The transition
looks the same (current pose → new animation) but no live animation is
running during the blend, so no child mesh drift and no spurious triggers.

https://claude.ai/code/session_01DyCmMzSbLw9z3hgiLNhW4w
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

Warning

Rate limit exceeded

@tracygardner has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 27 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 902d3047-daf5-46b5-a321-d1a8e3749b53

📥 Commits

Reviewing files that changed from the base of the PR and between 310ab7a and 1a7b8fd.

📒 Files selected for processing (1)
  • api/animate.js
📝 Walkthrough

Walkthrough

Animation blending behavior is updated in _switchToAnimationLoad and _switchToAnimationModel: the outgoing animation group is now stopped immediately when blending, and the blend-out source is derived from a frozen pose snapshot instead of using the live group directly.

Changes

Animation Blend-Out Source Update

Layer / File(s) Summary
Core Blend Logic
api/animate.js (lines 1488–1501, 1815–1830)
In both _switchToAnimationLoad and _switchToAnimationModel, the outgoing animation is stopped immediately during blend transitions. The effectiveOutgoing input to blending is now sourced from a frozen pose snapshot (created via _createCurrentPoseGroup) rather than the live outgoing group, ensuring the blend-out pose is fixed at transition time.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

codex

Poem

🐰 Animations now freeze mid-leap,
Snapshots caught before they sleep,
Outgoing stops with graceful care,
Blends from poses suspended in air!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: stopping outgoing animations during blend transitions. This aligns perfectly with the PR's core objective of preventing jitter by stopping outgoing animations immediately when blending begins.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-water-map-jitter-ruGZ2

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 51 minutes and 27 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@api/animate.js`:
- Around line 1488-1500: Prettier reported formatting issues in the animate.js
block around outgoingGroup/snap handling; run the code formatter (prettier
--write .) and commit the resulting changes so the snippet around
flock._createCurrentPoseGroup(mesh, scene), outgoingGroup.stop(),
snap._isSnapshot, snap.start(...), snap.setWeightForAllAnimatables(1) and
effectiveOutgoing is consistently formatted to satisfy CI. Ensure no other style
violations are left and re-run the Prettier check locally before pushing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 494c6e76-e92a-4819-9486-57293895d84c

📥 Commits

Reviewing files that changed from the base of the PR and between 72bfec7 and 310ab7a.

📒 Files selected for processing (1)
  • api/animate.js

Comment thread api/animate.js Outdated
The water trigger box (21x21 units) extends up the depression slope, so it
fires before the player visually reaches the water. The previous code
immediately switched to a horizontal capsule for the Fly animation, which
is designed for airborne movement and becomes unstable on slopes — causing
physics jitter before the player reaches the water.

Fix: when determineDesiredShapeType returns horizontal-fly, check if the
mesh is currently on a surface (checkIfOnSurface ray cast). If so, keep the
vertical capsule instead. For ground-based Fly use cases like swimming the
vertical capsule is correct, and the horizontal capsule is still used for
genuine airborne Fly.

https://claude.ai/code/session_01DyCmMzSbLw9z3hgiLNhW4w
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying flockxr with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1a7b8fd
Status: ✅  Deploy successful!
Preview URL: https://0fbe8254.flockxr.pages.dev
Branch Preview URL: https://claude-fix-water-map-jitter.flockxr.pages.dev

View logs

@tracygardner tracygardner deleted the claude/fix-water-map-jitter-ruGZ2 branch May 6, 2026 07:07
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.

2 participants