Rapier has more than gravity.
This route turns Rapier's engine-specific addon surface into a terrain experiment: a generated heightfield collider, indexed body transforms, explicit velocity and impulse writes, and remove/re-add lifecycle paths.
Preparing the terrain mesh, heightfield data, and RapierPhysics...
- physics
- -
- active bodies
- -
- removed
- -
- terrain
- -
- velocities
- -
- impulses
- -
- fps
- -
Select a body to inspect its indexed transform and lifecycle state.
await RapierPhysics()create gravity worldphysics.addHeightfield(...)register terrain colliderphysics.addMesh(...)register ordinary bodyphysics.setMeshVelocity(...)write linear velocityphysics.applyImpulse(...)apply an impulsephysics.removeMesh(...)remove body + collidernew RapierHelper(world)inspect collider topologyThe heightfield uses a 17 × 17 sampled grid and the same height function drives its visible mesh and physics data. Removal is followed by an explicit re-add so the addon-owned body map stays observable.
Rapier is loading. The helper and heightfield become available only with a live Rapier world.
Based on the official Rapier addon docs and instancing example. The CPU fallback approximates terrain contact and retains the same labels, but it does not claim full Rapier parity.