Expose btCollisionObject interpolation transform and velocity accessors#446
Merged
Merged
Conversation
Contributor
Author
|
The failing CI here isn't caused by this change. I built and tested this change on a pinned emsdk 3.1.35 (the toolchain the committed I'll open a separate PR to repair the CI setup (pin emsdk so |
4ee3933 to
1870eab
Compare
Binds the six public btCollisionObject interpolation methods (world transform + linear/angular velocity get/set), available on btRigidBody and the other btCollisionObject subtypes via `implements`. Lets callers reset Bullet's interpolation state after setting a body's transform directly, so motion-state read-back is correct on frames that run zero fixed substeps. Adds tests/interpolation.js and rebuilds builds/* (emsdk 3.1.35). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1870eab to
75bb530
Compare
kripken
approved these changes
Jun 16, 2026
Merged
3 tasks
willeastcott
added a commit
to playcanvas/engine
that referenced
this pull request
Jun 17, 2026
… rates (#8915) * fix(physics): keep interpolation in sync on teleport for high refresh rates A dynamic body's teleport (syncEntityToBody) only set its world transform. On frames that run zero fixed sub-steps (dt < fixedTimeStep, e.g. high refresh-rate displays), Bullet fills the motion state by extrapolating from the stale interpolation transform, so the entity read back its pre-teleport pose (#4277, #7822). Reset the interpolation transform and linear/angular velocity for dynamic bodies, feature-detected so older ammo builds (lacking the bindings) no-op. Bundled ammo updated to the build exposing the btCollisionObject interpolation accessors (kripken/ammo.js#446). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(physics): zero interpolation velocities so teleport read-back is exact Per review: copying the body's velocity into the interpolation state left the read-back within velocity*fixedTimeStep of the target (Bullet extrapolates from the interpolation transform by the leftover sub-step fraction). Zeroing the interpolation velocities makes getPosition() return exactly the teleport target on every frame, including for a moving body. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <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.
Binds the six public
btCollisionObjectinterpolation methods, which currently have no WebIDL bindings:get/setInterpolationWorldTransformset/getInterpolationLinearVelocityset/getInterpolationAngularVelocityThey're declared on
btCollisionObject, so via the existingimplementsthey're also available onbtRigidBody,btGhostObject, andbtSoftBody.Why: after setting a body's world transform directly (e.g. a teleport), Bullet's
synchronizeMotionStates()still extrapolates the motion state from the interpolation transform, whichsetWorldTransformdoesn't update. With these bound, a caller can reset the interpolation transform/velocities too, so motion-state read-back is correct even on frames that run zero fixed substeps. (Fixes the high-refresh teleport issue in PlayCanvas — playcanvas/engine#4277, playcanvas/engine#7822.)builds/*rebuilt with emsdk 3.1.35. Addstests/interpolation.js, which round-trips all six on abtRigidBody.