@skidpad/rapier
v0.8.0
Published
Rapier 3D host adapter for Skidpad: drives a Rapier rigid body with the Skidpad four-wheel vehicle model.
Maintainers
Readme
@skidpad/rapier
Drives a Rapier 3D rigid body with the
@skidpad/core four-wheel
model, so a car drives on real geometry. Works with
@dimforge/rapier3d-compat and with the cross-platform deterministic
@dimforge/rapier3d-deterministic-compat; install either.
import RAPIER from "@dimforge/rapier3d-compat";
import { createChassisBody, RapierVehicle, surfaceIdsByHandle } from "@skidpad/rapier";
await RAPIER.init();
const scene = new RAPIER.World({ x: 0, y: -9.81, z: 0 });
const car = world.addVehicle(def);
const body = createChassisBody(RAPIER, scene, def);
const host = new RapierVehicle(RAPIER, world, car, body, scene, {
surfaceId: surfaceIdsByHandle(surfaceByColliderHandle),
});
scene.step(); // once, so the first wheel rays can hit
// each frame
host.step(1 / 60);
scene.step();Guide: driving a Rapier body.
License: MIT OR Apache-2.0.
