Rapier is a high-performance physics engine, written in Rust, which can be loaded as a WASM bundle. I’ve been using it in my FRPG game for the last couple of years.
I’ve recently updated my example app which shows how to get Rapier and Three.js working together. This shows how to load the WASM bundle, initialize it, and create some basic rigid bodies and colliders as well as a terrain heightfield. It also shows how to set up a basic Vite build configuration, unit tests, eslint, prettier and all of the other infrastructure that is great to have if you are doing a serious project with three.js.
The demo now uses the regular “@dimforge/rapier3d” instead of the less efficient “@dimforge/rapier3d-compat” (the latter is meant for bundlers which have trouble loading WASM bundles, which is no longer an issue.)