Skip to main content

Use Physics Engine

Use physics v2 to perform physics simulation.

Emable Physics

Enable the physics using havok physics engine.

src/sceneBuilder.ts
import HavokPhysics from "@babylonjs/havok";
// ...
scene.enablePhysics(new Vector3(0, -9.8 * 10, 0), new HavokPlugin(true, await HavokPhysics()));

Use MMD Physics

Create new MmdPhysics and pass it to MmdRuntime.

src/sceneBuilder.ts
const mmdRuntime = new MmdRuntime(scene, new MmdPhysics(scene));
info

MmdPhysics is powered by havok physics, which can lead to much different results than MMD.

For heavier, but more MMD-like results, you can use MmdAmmoPhysics, which is powered by ammo.js