Physics

Physics engines are third party external programs that can be plugged into Babylon.js. They, depending on their features, emulate "real-life" interactions between objects, which can be meshes, solid particles from the solid particle system or some cameras. One feature of a Physics Engine is the addition of gravity to a scene.

There are plugins for 3 physics engines:

  1. Cannon.js - a wonderful physics engine written entirely in JavaScript
  2. Oimo.js - a JS port of the lightweight Oimo physics engine
  3. Ammo.js - a JS post of the bullet physics engine

All need to be enabled before use.

Interactions between objects are achieved by imposters, simple objects that are attached to any complex objects with a scene. The imposter can be assigned physical attributes such as mass, friction, a coefficient of restitution, impulse, and linear and angular

Two imposters can be connected using joints such as a hinge or ball and socket.

Ammo also allows the creation of soft bodies.

Coming next

Using A Physics Engine
Learn how to use one of the available physics engines in Babylon.js.
Forces
Learn all about applying physical forces in Babylon.js.
Joints
Learn all about using joints in physics engines within Babylon.js.
Pivots and Axes
Learn all about physics pivots and axes in Babylon.js.
Compound Bodies
Learn all about physics compound bodies in Babylon.js.
Soft Bodies
Learn all about physics soft bodies in Babylon.js.
Advanced Physics Features
Unlock the full potential of physics with advanced physics features in Babylon.js.
Add Your Own Physics Engine
Learn how to add your own physics engine to Babylon.js.