A C-Frame fork, collectively maintained by the A-Frame community. Also see the wiki page.
Components for A-Frame physics integration.
Supports CANNON.js and Ammo.js. See examples.
Which engine you pick will depend a lot on your specific requirements. Currently there are 3 options for A-Frame physics that may be worth considering:
Since each driver has a slightly different component interface and schema, it will require some significant updates to your code to switch from one driver to another, so it’s worth taking some time up-front to consider which driver is most likely to suit your needs.
At a high level:
For each of these drivers, there is the potential for specific limitations that could be problematic. These could be limitations
See Driver-specific Limitations below for a list of known driver-specific limitations.
Installation instructions vary slightly depending on the driver being used, so see detailed documentation for each driver
The components and schemas for aframe-physics system vary depending on whether you are using the Cannon.js or Ammo.js driver.
See detailed documentation for each driver
Although the syntax for each driver is different, the basic concepts are the same.
physics
component is added to the <a-scene>
. The driver
property of this component indicates which driver to use. The debug
property can be set to true
to get some useful visual hints from the physics engine. There are also various other driver-specific scene-level settings.dynamic-body
or static-body
component.ammo-body
(to define the phsyics properties of the body) and ammo-shape
(to define its shape). The type
property on ammo-body
is used to specify whether the body is dynamic
, kinematic
or static
For more details, see detailed documentation for each driver
More sophisticated use cases require more than just the configuration of dynamic, static and kinematic bodies.
Both drivers also allow for the configuration of constraints
Constraints such as hinges, springs and so on can be configured between bodies (or between specific points on the surfaces bodies), to provide more sophisticated interactions. See driver-specific documentation for details.
Both drivers also have APIs that offer
Specific details vary between drivers, so you should consult driver-specific documentation for details. Since Cannon.js is written in native Javascript, its API is generally easier to use, and problems are simpler to debug. In comparison, making use of the Ammo.js APIs can be quite hard work (there’s definitely scope to improve the available documentation and examples here!)
This is a list of limitations that has been oberved with particular drivers (and also with physx). It’s intended to provide a checklist to help developers to choose between physics drivers for a particular project, so they don’t pick a driver that turns out to be missing some feature that is fundamental for their application.
This list is probably incomplete, so if you find an additional significant limitation, please add it to this list.
No support for off-center attachment of spring constraints to bodies (integration issue?)
No support for slider constraint (slider constraint is like a bead on an abacus) (integration issue?)
To help demonstrate the features and capabilities of aframe-physics-system
a collection of examples have been prepared. Please see examples for a summary and link to each of the prepared examples.