Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Deploy master examples #169

Merged
merged 8 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build distribution
on:
push:
branches:
- master
paths:
- 'src/**'
- 'package.json'
- 'package-lock.json'
- 'lib/**'
jobs:
build:
runs-on: ubuntu-18.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Build distributions
run: npm run dist
- name: Update built distributions
run: |
git config user.name aframe-physics-system
git config user.email aframe-physics-system@github.com
git add dist
git update-index --refresh
git diff-index --quiet HEAD dist || git commit -m "Update built distributions"
git push
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Ammo.js driver support has been added. Please see [Ammo Driver](/AmmoDriver.md)
+ [Using the CANNON.js API](#using-the-cannonjs-api)
+ [Events](#events)
+ [System Configuration](#system-configuration)
+ [Examples](#examples)

## Installation

Expand Down Expand Up @@ -181,7 +182,7 @@ Example:

```html
<a-box id="other-box" dynamic-body />
<a-box constraint="target: #other-box;" dynamic-body />
<a-box constraint="target: #other-box;" dynamic-body />
```

| Property | Dependencies | Default | Description |
Expand Down Expand Up @@ -309,3 +310,9 @@ Resources:
* [CANNON.World](http://schteppe.github.io/cannon.js/docs/classes/World.html)
* [CANNON.ContactMaterial](http://schteppe.github.io/cannon.js/docs/classes/ContactMaterial.html)

## Examples

To help demonstrate the features and capabilities of `aframe-physics-system` a
collection of examples have been prepared. Please see
[Examples](examples/README.md) for a summary and link to each of the
prepared examples.
47 changes: 47 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Examples

To help demonstrate the features and capabilities of `aframe-physics-system`
the following collection of examples have been prepared.

- [**Ammo sandbox**](ammo.html)
Demonstration of many [Ammo driver](/AmmoDriver.md) features in a single
example.

- [**Cannon.js sandbox**](cannon.html)
Demonstration of many Cannon driver features in a single example.

- [**Compound**](compound.html)
Construct a [compound shape](/README.md#shape) and simulate collision with
a ground plane using the Cannon driver.

- [**Constraints with Ammo**](constraints-ammo.html)
Demonstration of many
[Ammo driver constraints](/AmmoDriver.md#ammo-constraint) including cone
twist, hinge, lock, point to point, and slider constraints.

- [**Constraints with Cannon**](constraints.html)
Demonstration of many
[Cannon driver constraints](/README.md#constraint) including cone twist,
hinge, lock, point to point, and distance constraints.

- [**Materials**](materials.html)
Bounce simulation with
[restitution (bounciness)](/README.md#system-configuration) of 1 using the
Cannon driver.

- [**Spring**](spring.html)
Four vertical [springs](/README.md#spring) each between two boxes with an
assortment of damping and stiffness values using the Cannon driver.

- [**Stress**](stress.html)
Apply [strong impulse](/README.md#using-the-cannonjs-api) to a cube when the
user clicks with a mouse using the Cannon driver. Cubes are arranged in four
4x3 walls.

- [**Sweeper**](sweeper.html)
Animate a long wall moving along the z-axis along the initial view direction
using the velocity component and the Cannon driver.

- [**Time to live**](ttl.html)
Remove a [dynamic body](README.md#dynamic-body-and-static-body) from the
scene after 100 frames using the Cannon driver.
2 changes: 1 addition & 1 deletion examples/ammo.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="description" content="Hello, WebVR! - A-Frame" />
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://mixedreality.mozilla.org/ammo.js/builds/ammo.wasm.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
<script>
AFRAME.registerComponent("bounce", {
init: function() {
Expand Down
3 changes: 1 addition & 2 deletions examples/cannon.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Examples • CannonDriver</title>
<meta name="description" content="Hello, WebVR! - A-Frame">
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
<script>
AFRAME.registerComponent('bounce', {
init: function() {
Expand Down Expand Up @@ -46,4 +46,3 @@
</a-scene>
</body>
</html>

2 changes: 1 addition & 1 deletion examples/compound.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://rawgit.com/feiss/aframe-environment-component/master/dist/aframe-environment-component.min.js"></script>
<script src="https://cdn.rawgit.com/donmccurdy/aframe-extras/v4.2.0/dist/components/sphere-collider.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
<script src="components/force-pushable.js"></script>
</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions examples/constraints-ammo.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://mixedreality.mozilla.org/ammo.js/builds/ammo.wasm.js"></script>
<script src="https://rawgit.com/feiss/aframe-environment-component/master/dist/aframe-environment-component.min.js"></script>
<script src="https://rawgit.com/fernandojsg/aframe-teleport-controls/master/dist/aframe-teleport-controls.min.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
</head>
<body>
<a-scene environment physics="driver: ammo; debug: true">
Expand Down Expand Up @@ -51,7 +51,7 @@
<a-box depth="0.1"
color="#F00"
scale="0.25 0.25 0.25"
ammo-body ammo-shape
ammo-body ammo-shape
ammo-constraint="type: hinge;
target: #hinge-target;
axis: 0 1 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/constraints.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://rawgit.com/feiss/aframe-environment-component/master/dist/aframe-environment-component.min.js"></script>
<script src="https://rawgit.com/fernandojsg/aframe-teleport-controls/master/dist/aframe-teleport-controls.min.js"></script>
<script src="https://cdn.rawgit.com/donmccurdy/aframe-extras/v4.2.0/dist/components/sphere-collider.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
<script src="components/grab.js"></script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://rawgit.com/feiss/aframe-environment-component/master/dist/aframe-environment-component.min.js"></script>
<script src="https://cdn.rawgit.com/donmccurdy/aframe-extras/v3.2.5/dist/components/sphere-collider.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
<script src="components/force-pushable.js"></script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/spring.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no,user-scalable=no,maximum-scale=1">
<title>Examples • Spring</title>
<script type="text/javascript" src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
</head>
<body>
<a-scene stats>
Expand Down
2 changes: 1 addition & 1 deletion examples/stress.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://rawgit.com/feiss/aframe-environment-component/master/dist/aframe-environment-component.min.js"></script>
<script src="https://cdn.rawgit.com/donmccurdy/aframe-extras/v4.2.0/dist/components/sphere-collider.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
<script src="components/force-pushable.js"></script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/sweeper.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://rawgit.com/feiss/aframe-environment-component/master/dist/aframe-environment-component.min.js"></script>
<script src="https://cdn.rawgit.com/donmccurdy/aframe-extras/v4.2.0/dist/components/sphere-collider.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
<script src="components/grab.js"></script>
<script src="components/rain-of-entities.js"></script>
<script src="components/force-pushable.js"></script>
Expand Down
3 changes: 1 addition & 2 deletions examples/ttl.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Examples • TTL</title>
<meta name="description" content="Hello, WebVR! - A-Frame">
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="../bundle.js"></script>
<script src="../dist/aframe-physics-system.js"></script>
<script>
AFRAME.registerComponent('ttl', {
schema: {
Expand Down Expand Up @@ -36,4 +36,3 @@
</a-scene>
</body>
</html>

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Physics system for A-Frame VR, built on Cannon.js",
"main": "index.js",
"scripts": {
"dev": "budo index.js:bundle.js -d examples --port 8000",
"dev": "budo index.js:dist/aframe-physics-system.js -d examples --port 8000",
"dist": "browserify index.js -o dist/aframe-physics-system.js && uglifyjs -c -o dist/aframe-physics-system.min.js -- dist/aframe-physics-system.js",
"test": "karma start ./tests/karma.conf.js",
"test:once": "karma start ./tests/karma.conf.js --single-run",
Expand Down