fix(physics): kinematic collider support for movable platforms - #255
Merged
Conversation
Let a mass-0 collider that is moved/rotated by a script carry resting dynamic bodies instead of letting them fall through. - makeKinematic + an explicit `kinematic` flag threaded through createRigidBody / addBox / addSphere - auto-promote a static body to kinematic the first time a script moves or rotates it (so existing graphs work without re-authoring) - CCD on dynamic bodies (sized from the collider) to stop fast bodies tunnelling through thin colliders - pin a kinematic body's origin to an authoritative kinematicPosition so rotation cannot accumulate positional drift; reading Bullet's extrapolated transform back was causing runaway blow-ups under non-default gravity - harden the solver (split impulse + more iterations) against deep-penetration velocity spikes Adds unit tests for the kinematic flag arithmetic, CCD wiring, and auto-promotion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
marco-ponds
marked this pull request as ready for review
July 3, 2026 15:37
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Rotating (or moving) a physics collider with mass 0 made resting objects fall through it. A mass-0 body is a Bullet static body — teleporting its transform each frame reports zero velocity to the solver, so a resting sphere loses support and tunnels through.
Changes
makeKinematic+ an explicitkinematicflag threaded throughcreateRigidBody/addBox/addSphere. A kinematic body stays mass-0 but is driven by its motionState, so Bullet derives its velocity and carries contacting dynamic bodies.kinematicPosition. Reading Bullet's extrapolated world transform back on a rotation-only update let the body's origin drift and run away — the platform slid off and exploded under non-default gravity. This was the root cause of the gravity-dependent blow-up.Tests
Adds unit tests for the kinematic flag arithmetic, CCD wiring, and auto-promotion. Full physics suite green (71 tests).
Verification
Verified in-editor via preview across multiple gravity settings (default 30, 40, 60): the platform rotates in place, carries the resting sphere, and no longer explodes.
🤖 Generated with Claude Code