Rapier Physics

Rigidbody-feature must be added to object first before Collider feature.
Otherwise collider won't be associated with rigidbody you added to object.

import * as RAPIER from "@dimforge/rapier3d-compat";
import * as KVY from "@vladkrutenyuk/three-kvy-core";
import {
	Collider,
	RigidbodyDynamic,
    RigidbodyFixed,
	RapierPhysics,
	RapierDebugRenderer,
} from "@vladkrutenyuk/three-kvy-core/addons";
import * as THREE from "three";

const ctx = KVY.CoreContext.create(THREE, {}, { renderer: { antialias: true } });
ctx.three.mount(document.querySelector("#canvas-container"));
ctx.run();

const ground = new THREE.Mesh(new THREE.BoxGeometry(), new THREE.MeshMatcapMaterial({ color: 0x505050 }));
ground.scale.set(6, 0.4, 6);
KVY.addFeature(ground, RigidbodyFixed);
KVY.addFeature(ground, Collider, ["cuboid", 3, 0.2, 3]);

const box = new THREE.Mesh(new THREE.BoxGeometry(), new THREE.MeshMatcapMaterial());
KVY.addFeature(box, RigidbodyDynamic);
KVY.addFeature(box, Collider, ["roundCuboid", 0.5, 0.5, 0.5, 0.1]);

RAPIER.init().then(() => {
	const rapier = new RapierPhysics(RAPIER);
	const debug = new RapierDebugRenderer();
	ctx.assignModules({ rapier, debug });

	ctx.root.add(ground);
	ctx.root.add(box);
});

class ResetByInterval extends KVY.Object3DFeature {
	useCtx() {
		const rb = KVY.getFeature(box, RigidbodyDynamic)?.rb;
		if (!rb) return;

		const reset = () => {
			this.object.rotateX(1).rotateY(1).rotateZ(1);
			rb.setTranslation({ x: 0, y: 3, z: 0 }, true);
			rb.setRotation(box.quaternion, true);
		}
		reset();
		const id = setInterval(reset, 1000);

		return () => clearInterval(id);
	}
}
KVY.addFeature(box, ResetByInterval);


const { camera } = ctx.three;
camera.position.set(5, 5, 5);
camera.lookAt(new THREE.Vector3());
three-kvy-core ...