If the physics simulation is paused
Direct access to the Rapier instance
Can be used to overwrite the current World. Useful when working with snapshots.
import { useRapier } from '@react-three/rapier';
const SnapshottingComponent = () => {
const { world, setWorld, rapier } = useRapier();
const worldSnapshot = useRef<Uint8Array>();
// Store the snapshot
const takeSnapshot = () => {
const snapshot = world.takeSnapshot()
worldSnapshot.current = snapshot
}
// Create a new World from the snapshot, and replace the current one
const restoreSnapshot = () => {
setWorld(rapier.World.restoreSnapshot(worldSnapshot.current))
}
return <>
<Rigidbody>...</RigidBody>
<Rigidbody>...</RigidBody>
<Rigidbody>...</RigidBody>
<Rigidbody>...</RigidBody>
<Rigidbody>...</RigidBody>
</>
}
Step the physics world one step
step(1/60)
The delta time to step the world with
The Rapier physics world
Generated using TypeDoc
Is debug mode enabled