Physics
Most video games you have ever played will have some form of physics. The player expects objects to fall under the influence of gravity. For objects to collide instead of pass through each other. For a sound to play if two objects collide. And so on.
A physics engine attempts to reproduce our understanding of the natural world in an artificial game world. It attempts to realistically animate objects in an expected and predictable way.

PlayCanvas physics is powered by ammo.js, a WebAssembly port of the open source Bullet physics engine. You work with it through components. The rigidbody component decides how an entity moves, the collision component gives it a physical shape, and the alpha joint component constrains bodies to one another. The same components, with the same properties, are available whichever way you build: in the Editor, directly against the engine, in PlayCanvas React and in Web Components. Each page in this section explains a concept once and then shows how to apply it on each of those surfaces.
This section covers:
- Getting Started - Enabling physics, gravity, units and how the simulation runs.
- Rigid Bodies - Static, dynamic and kinematic bodies, their properties, sleeping and teleporting.
- Collision Shapes - Primitive, mesh and compound shapes, offsets and scale.
- Moving Bodies - Forces, impulses, torque, velocity and kinematic motion.
- Collision Events - Responding to contacts between rigid bodies.
- Trigger Volumes - Detecting when bodies enter and leave a region.
- Ray Casting - Querying the scene along a line for picking and probing.
- Joints - Hinges, sliders, ball joints, springs and breakable welds.
- Calling ammo.js Directly - Reaching Bullet features that the components do not expose.
- Alternatives to ammo.js - Other physics engines and how they could be integrated.
See Also
- Collision and Triggers - Tutorial that builds a complete physics scene in the Editor
- Creating Rigid Bodies in Code - Tutorial that spawns physics objects from scripts
- Vehicle Physics - Tutorial that drives a raycast vehicle
- Physics in PlayCanvas React - The React guide to enabling and using physics
<pc-rigid-body>- The Web Components rigid body reference