Physics components for A-Frame VR.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dist bump Feb 18, 2016
examples update to boilerplate, bump 0.2.0 Mar 26, 2016
src Support CannonDebugRenderer May 2, 2016
tests it's a 212F dish Dec 19, 2015
.gitignore fix ghpages Jan 10, 2016
LICENSE Initial commit Dec 18, 2015 aframe-extras May 19, 2016
package.json bump Mar 26, 2016


Also check out Don McCurdy's physics implementation in aframe-extras.

Experimental physics components for A-Frame VR using cannon.js.



Browser Installation

Install and use by directly including the browser files:

  <title>My A-Frame Scene</title>
  <script src=""></script>
  <script src=""></script>

  <a-scene physics-world="gravity: 0 -9.8 0">
    <a-entity physics-body="boundingBox: 1 1 1; mass: 5; velocity: 0.2 0 0"
              geometry="primitive: box" material="color: red"></a-entity>

NPM Installation

Install via NPM:

npm install aframe-physics-components

Then register and use.



physics-body Component

Property Description Type Default Value
angularVelocity (in deg/s) vec3 0 0 0
boundingBox Collision box (in m). vec3 0 0 0
mass (in kg) number 1
velocity (in m/s) vec3 0 0 0
Event Name Description
collide Emitted when entity collides with another entity. Event contains contact.
applyImpulse (impulseVec3, positionVec3)

Applies an impulse (indicated by impulseVec3) at the body's local point (indicated by positionVec3). forceVec3 is in Force / Time (Newtons / Seconds).

// Applies a small force from left-to-right to the top-left of the body.
var hitMeBody = document.querySelector('#hit-me-entity').components['physics-body'];
hitMeBody.applyImpulse({ x: 10, y: 0, z: 0 }, { x: -1, y: 1, z: 0 });

physics-world Component

Property Description Default Value
gravity vec3 0 -9.8 0
Event Name Description
beginContact Emitted when an entity in the world begins contact with another entity. Event contains bodyA and bodyB.
endContact Emitted when an entity in the world ends contact with another entity. Event contains bodyA and bodyB.