THREE.JS / FOUNDATIONS 201

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.

Initializing Preparing renderer

Preparing the terrain mesh, heightfield data, and RapierPhysics...

physics
-
active bodies
-
removed
-
terrain
-
velocities
-
impulses
-
fps
-
Feature surface controlsselected body

Select a body to inspect its indexed transform and lifecycle state.

Rapier feature contractofficial addon methods
await RapierPhysics()create gravity world
physics.addHeightfield(...)register terrain collider
physics.addMesh(...)register ordinary body
physics.setMeshVelocity(...)write linear velocity
physics.applyImpulse(...)apply an impulse
physics.removeMesh(...)remove body + collider
new RapierHelper(world)inspect collider topology

The 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.

Selected bodynone
shape-
position-
lifecycle-
API path-

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.

THREE.JS FOUNDATIONS LAB