THREE.JS / FOUNDATIONS / AMMO HEIGHTFIELD

A terrain owns the collision shape.

This native Ammo study follows the pinned heightfield example: generated float samples are copied into the Ammo heap, wrapped by btHeightfieldTerrainShape, and used by falling rigid bodies.

Loading Ammo Preparing renderer

Preparing the native heightfield world...

physics
-
samples
-
height range
-
bodies
-
steps
-
heap bytes
-
sample
-
Heightfield controlssource-shaped native path

The default profile uses 128 × 128 float samples, a 100 × 100 terrain extent, and a centered Bullet heightfield.

Native contractAmmo/WASM bridge
Ammo().then(...)load the pinned WASM module
Ammo._malloc(4 * 128 * 128)own heap-backed float samples
btHeightfieldTerrainShapebind terrain collision
world.stepSimulationadvance rigid bodies

The route intentionally uses direct Ammo bindings because the installed AmmoPhysics helper does not expose heightfield shapes.

Based on the pinned official Ammo terrain example. This is a native behavior lab with deterministic local terrain generation, not a claim of exact official page, asset, pixel, or whole-example fidelity.

THREE.JS FOUNDATIONS LAB