Rigidbody
The Rigidbody component enables physics for an Entity, allowing it to interact with the global physics simulation. You can apply forces, torques, and other physics behaviors to an entity with a Rigidbody component and it will respond accordingly.
Note
Run npm i sync-ammo and use <Application usePhysics/> to enable physics.
You can learn more about how physics work in PlayCanvas in the Physics docs .
Usage
rigidbody.jsx
import { Rigidbody } from '@playcanvas/react/components'
const RigidbodyExample = () => {
return <Entity>
<Rigidbody type="dynamic" mass={12} />
<Render type="box" />
</Entity>
}Props
The following props are based on the RigidBody Component from PlayCanvas version 2.11.8. This documentation is automatically generated from the TypeScript types of the installed PlayCanvas package.
Last updated on