<commit_before># Physics for A-Frame VR

[![Build Status](https://travis-ci.org/donmccurdy/aframe-physics-system.svg?branch=master)](https://travis-ci.org/donmccurdy/aframe-physics-system)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/donmccurdy/aframe-physics-system/master/LICENSE)

Components for A-Frame physics integration, built on [CANNON.js](http://schteppe.github.io/cannon.js/).

![d6590832-8bdb-11e6-9336-658b00bc0460 3](https://cloud.githubusercontent.com/assets/1848368/19297499/806d059a-9013-11e6-9b20-c03294acbc4c.png)

> Image credit [@andgokevin](https://twitter.com/andgokevin).

## Components

The `dynamic-body` and `static-body` components may be added to any `<a-entity/>` that contains a mesh. Generally, each scene will have at least one `static-body` for the ground, and one or more `dynamic-body` instances that the player can interact with.

- **dynamic-body**: A freely-moving object. Dynamic bodies have mass, collide with other objects, bounce or slow during collisions, and fall if gravity is enabled.
- **static-body**: A fixed-position or animated object. Other objects may collide with static bodies, but static bodies themselves are unaffected by gravity and collisions.

## Basic Usage

```html
<!-- The debug:true option creates a wireframe around each physics body. If you don't see a wireframe,
     the physics system may be unable to parse your model without a shape:box or shape:hull option. -->
<a-scene physics="debug: true">

  <!-- Camera -->
  <a-entity camera universal-controls kinematic-body></a-entity>

  <!-- Floor -->
  <a-grid static-body></a-grid><commit_msg>Add usage instructions.<commit_after># Physics for A-Frame VR

[![Build Status](https://travis-ci.org/donmccurdy/aframe-physics-system.svg?branch=master)](https://travis-ci.org/donmccurdy/aframe-physics-system)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/donmccurdy/aframe-physics-system/master/LICENSE)

Components for A-Frame physics integration, built on [CANNON.js](http://schteppe.github.io/cannon.js/).

![d6590832-8bdb-11e6-9336-658b00bc0460 3](https://cloud.githubusercontent.com/assets/1848368/19297499/806d059a-9013-11e6-9b20-c03294acbc4c.png)

> Image credit [@andgokevin](https://twitter.com/andgokevin).

## Usage (Scripts)

In the [dist/](https://github.com/donmccurdy/aframe-physics-system/tree/master/dist) folder, download the full or minified build. Include the script on your page, and all components are automatically registered for you:

```html
<script src="//cdn.rawgit.com/donmccurdy/aframe-physics-system/v1.0.2/dist/aframe-physics-system.min.js"></script>
```

CDN builds for aframe-extras/v1.0.2:

- [aframe-physics-system.js](https://cdn.rawgit.com/donmccurdy/aframe-physics-system/v1.0.2/dist/aframe-physics-system.js) *(development)*
- [aframe-physics-system.min.js](https://cdn.rawgit.com/donmccurdy/aframe-physics-system/v1.0.2/dist/aframe-physics-system.min.js) *(production)*

## Usage (NPM)

```
npm install --save aframe-physics-system
```

```javascript
// my-app.js
var physics = require('aframe-physics-system');
physics.registerAll();
```

Once installed, you'll need to compile your JavaScript using something like [Browserify](http://browserify.org/) or [Webpack](http://webpack.github.io/). Example:

```bash
npm install -g browserify
browserify my-app.js -o bundle.js
```

`bundle.js` may then be included in your page. See [here](http://browserify.org/#middle-section) for a better introduction to Browserify.

## Components

The `dynamic-body` and `static-body` components may be added to any `<a-entity/>` that contains a mesh. Generally, each scene will have at least one `static-body` for the ground, and one or more `dynamic-body` instances that the player can interact with.

- **dynamic-body**: A freely-moving object. Dynamic bodies have mass, collide with other objects, bounce or slow during collisions, and fall if gravity is enabled.
- **static-body**: A fixed-position or animated object. Other objects may collide with static bodies, but static bodies themselves are unaffected by gravity and collisions.

## Basic Usage

```html
<!-- The debug:true option creates a wireframe around each physics body. If you don't see a wireframe,
     the physics system may be unable to parse your model without a shape:box or shape:hull option. -->
<a-scene physics="debug: true">

  <!-- Camera -->
  <a-entity camera universal-controls kinematic-body></a-entity>

  <!-- Floor -->
  <a-grid static-body></a-grid>
{'fraction_non_alphanumeric': 0.14120974760661445, 'fraction_numerical': 0.02959094865100087, 'mean_word_length': 4.585662211421628, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, 'https://': 15, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '276913', 'n_tokens_mistral': 1591, 'n_tokens_neox': 1459, 'n_words': 398}