Skip to content

fix(viewer): clamp GLB floor animation on slow frames - #820

Open
FenjuFu wants to merge 1 commit into
pascalorg:mainfrom
FenjuFu:fix/glb-level-animation-overflow
Open

fix(viewer): clamp GLB floor animation on slow frames#820
FenjuFu wants to merge 1 commit into
pascalorg:mainfrom
FenjuFu:fix/glb-level-animation-overflow

Conversation

@FenjuFu

@FenjuFu FenjuFu commented Sep 10, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes #616 by clamping the remaining GLB floor-animation interpolation factor to 1. A slow frame or resumed background tab can otherwise move baked floors past their target and make their positions diverge. This matches the already-clamped parametric LevelSystem; walkthrough mode still snaps to the baked elevation.

How to test

  1. Load a multi-floor baked GLB and switch between stacked and exploded modes.
  2. Exercise slow frames or resume a suspended tab; floors should stay between their previous and target elevations.
  3. Enter walkthrough mode and confirm floors immediately use their baked elevations.

Focused validation executed the actual priority-5 useFrame callback extracted from the source with the TypeScript AST, using structural level objects. All 14 stacked/exploded cases passed for frame deltas of 0, 1/60, 1/12, 0.1, 0.2, 0.5, and 30 seconds; ordinary-frame behavior and walkthrough snapping were preserved. At 0.5-second frames, the original callback diverged to approximately -4.5e28 while the fix settled at the expected 7.7 m elevation. This is deterministic frame-callback validation, not a full browser render.

Pinned Biome 2.4.16 and git diff --check passed. Complete fork CI also passed: lint/format, agent-skill validation, type checking, the full test suite, application/package builds, and the macOS packed CLI/runtime smoke test. The validation branch contains the same fix plus isolated CI-trigger configuration; those workflow changes are not part of this PR.

Screenshots / screen recording

No UI layout change; the regression concerns slow-frame level transforms.

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (file-scoped pinned Biome passed)
  • I've updated relevant documentation (not applicable)
  • This PR targets the main branch

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
@pascal

pascal Bot commented Sep 10, 2026

Copy link
Copy Markdown

I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…).

Please try again, rephrase, or reach out if it keeps failing.

Error id: 1a9cf6ac-9c83-4baa-b35c-9a397f573112

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.

LevelSystem: unclamped lerp factor sends level elevation to ~1e22 on slow frames

1 participant