forked from n5ro/aframe-physics-system
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from diarmidmackenzie/extend-examples
Extend examples
- Loading branch information
Showing
36 changed files
with
1,557 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no,user-scalable=no,maximum-scale=1"> | ||
<title>Examples • Compound AMMO</title> | ||
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/aframe-environment-component.min.js"></script> | ||
<script src="https://mixedreality.mozilla.org/ammo.js/builds/ammo.wasm.js"></script> | ||
<script src="../../dist/aframe-physics-system.js"></script> | ||
<script src="../components/force-pushable.js"></script> | ||
<script src="../components/grab.js"></script> | ||
<link rel="stylesheet" href="../styles.css"> | ||
</head> | ||
<body> | ||
<div class="text-overlay"> | ||
<p>Compound shape, using the Ammo driver.</p> | ||
<p>Click when the red reticle is over the sphere to apply a force to it.</p> | ||
</div> | ||
<a class="code-link" | ||
target="_blank" | ||
href="https://github.com/c-frame/aframe-physics-system/blob/master/examples/ammo/compound.html"> | ||
view code | ||
</a> | ||
<a-scene environment physics="driver: ammo; debug: true;"> | ||
<!-- Player --> | ||
<a-entity camera look-controls wasd-controls position="0 1.6 0"> | ||
<a-entity cursor | ||
raycaster="objects:[force-pushable]" | ||
position="0 0 -0.5" | ||
geometry="primitive: circle; radius: 0.01; segments: 4;" | ||
material="color: #FF4444; shader: flat"></a-entity> | ||
</a-entity> | ||
<a-entity id="left-hand" ammo-body="type: kinematic; emitCollisionEvents: true" ammo-shape="type: sphere; fit: manual; sphereRadius: 0.02;" | ||
hand-controls="hand: left" grab></a-entity> | ||
<a-entity id="right-hand" ammo-body="type: kinematic; emitCollisionEvents: true" ammo-shape="type: sphere; fit: manual; sphereRadius: 0.02;" | ||
hand-controls="hand: right" grab></a-entity> | ||
|
||
<!-- Terrain --> | ||
<a-box width="75" height="0.1" depth="75" ammo-body="type: static" ammo-shape visible="false"></a-box> | ||
|
||
<!-- Blocks --> | ||
<a-sphere radius="0.25" position="0 4 -2" color="red" | ||
ammo-body="type: dynamic; shape: none; mass: 5;" | ||
ammo-shape__main="type: cylinder; | ||
fit: manual; | ||
halfExtents: 0.24 0.18 0.24; | ||
cylinderAxis: y" | ||
ammo-shape__handle="type: box; | ||
fit: manual; | ||
halfExtents: 0.15 0.18 0.04; | ||
offset: 0.4 0 0;" | ||
force-pushable | ||
></a-sphere> | ||
</a-scene> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,27 +4,36 @@ | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no,user-scalable=no,maximum-scale=1"> | ||
<title>Examples • Constraints • AmmoDriver</title> | ||
<title>Examples • Constraints • AMMO</title> | ||
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script> | ||
<script src="https://mixedreality.mozilla.org/ammo.js/builds/ammo.wasm.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/aframe-environment-component.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/fernandojsg/aframe-teleport-controls@master/dist/aframe-teleport-controls.min.js"></script> | ||
<script src="../dist/aframe-physics-system.js"></script> | ||
<link rel="stylesheet" href="styles.css"> | ||
<script src="../../dist/aframe-physics-system.js"></script> | ||
<script src="../components/force-pushable.js"></script> | ||
<link rel="stylesheet" href="../styles.css"> | ||
</head> | ||
<body> | ||
<div class="text-overlay"> | ||
<p>Demonstration of many Ammo driver constraints including cone | ||
twist, hinge, lock, point to point, and slider constraints.</p> | ||
<p>Click when the red reticle is over a red object to apply a force to it.</p> | ||
<p>There seem to be problems with the slider constraint - to be investigated.</p> | ||
</div> | ||
<a class="code-link" | ||
target="_blank" | ||
href="https://github.com/c-frame/aframe-physics-system/blob/master/examples/consraints-ammo.html"> | ||
href="https://github.com/c-frame/aframe-physics-system/blob/master/examples/ammo/constraints.html"> | ||
view code | ||
</a> | ||
<a-scene environment physics="driver: ammo; debug: true"> | ||
<a-entity id="cameraRig"> | ||
<a-camera></a-camera> | ||
<a-entity camera look-controls wasd-controls position="0 1.6 0"> | ||
<a-entity cursor | ||
raycaster="objects:[force-pushable]" | ||
position="0 0 -0.5" | ||
geometry="primitive: circle; radius: 0.01; segments: 4;" | ||
material="color: #FF4444; shader: flat"></a-entity> | ||
</a-entity> | ||
<a-entity teleport-controls="cameraRig: #cameraRig; button: trigger; type: line" | ||
ammo-body="type: kinematic" | ||
ammo-shape="type: box; halfExtents: 0.05 0.1 0.1; fit: manual;" | ||
|
@@ -45,6 +54,7 @@ | |
</a-sphere> | ||
<a-box width="0.25" height="0.25" depth="0.25" color="#F00" | ||
ammo-body ammo-shape | ||
force-pushable | ||
ammo-constraint="type: coneTwist; | ||
target: #conetwist-target; | ||
pivot: 0.13 0 0.0; | ||
|
@@ -62,6 +72,7 @@ | |
color="#F00" | ||
scale="0.25 0.25 0.25" | ||
ammo-body ammo-shape | ||
force-pushable | ||
ammo-constraint="type: hinge; | ||
target: #hinge-target; | ||
axis: 0 1 0; | ||
|
@@ -85,6 +96,7 @@ | |
position="0 1.25 0" | ||
scale="0.25 0.25 0.25" | ||
ammo-body ammo-shape | ||
force-pushable | ||
ammo-constraint="type: lock; target: #lock-target"> | ||
</a-box> | ||
</a-entity> | ||
|
@@ -101,6 +113,7 @@ | |
<a-box color="#F00" | ||
scale="0.25 0.25 0.25" | ||
ammo-body ammo-shape | ||
force-pushable | ||
ammo-constraint="type: pointToPoint; | ||
target: #pointtopoint-target; | ||
pivot: -0.125 -0.125 0.125; | ||
|
@@ -121,6 +134,7 @@ | |
radius="0.125" | ||
position="0 1 0" | ||
ammo-body ammo-shape | ||
force-pushable | ||
ammo-constraint="type: slider; target: #slider-target"> | ||
</a-sphere> | ||
<a-cylinder radius="0.05" height="2" position="0 1 0" rotation="0 0 90"></a-cylinder> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no,user-scalable=no,maximum-scale=1"> | ||
<title>Examples • Materials AMMO</title> | ||
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/aframe-environment-component.min.js"></script> | ||
<script src="https://mixedreality.mozilla.org/ammo.js/builds/ammo.wasm.js"></script> | ||
<script src="../../dist/aframe-physics-system.js"></script> | ||
<script src="../components/force-pushable.js"></script> | ||
<script src="../components/grab.js"></script> | ||
<link rel="stylesheet" href="../styles.css"> | ||
</head> | ||
<body> | ||
<div class="text-overlay"> | ||
<p>Bounce simulation with restitution (bounciness) of 1 using the Ammo driver.</p> | ||
<p>Ball seems to bounce off to the left after a couple of bounces. Not understood why - inaccuracy in physics simulation, perhaps?</p> | ||
</div> | ||
<a class="code-link" | ||
target="_blank" | ||
href="https://github.com/c-frame/aframe-physics-system/blob/master/examples/ammo/materials.html"> | ||
view code | ||
</a> | ||
<a-scene stats="true" | ||
environment | ||
physics="driver: ammo; restitution: 1"> | ||
<a-entity camera look-controls wasd-controls position="0 1.6 0"> | ||
<a-entity cursor | ||
raycaster="objects:[force-pushable]" | ||
position="0 0 -0.5" | ||
geometry="primitive: circle; radius: 0.01; segments: 4;" | ||
material="color: #FF4444; shader: flat"></a-entity> | ||
</a-entity> | ||
<a-entity id="left-hand" ammo-body="type: kinematic; emitCollisionEvents: true" ammo-shape="type: sphere; fit: manual; sphereRadius: 0.02;" | ||
hand-controls="hand: left" grab></a-entity> | ||
<a-entity id="right-hand" ammo-body="type: kinematic; emitCollisionEvents: true" ammo-shape="type: sphere; fit: manual; sphereRadius: 0.02;" | ||
hand-controls="hand: right" grab></a-entity> | ||
|
||
<!-- Terrain --> | ||
<a-box width="75" height="0.1" depth="75" ammo-body="type: static; restitution:1" ammo-shape visible="false"></a-box> | ||
|
||
<!-- Blocks --> | ||
<a-sphere radius="0.25" position="0 4 -2" color="red" ammo-body="restitution:1" ammo-shape force-pushable></a-sphere> | ||
</a-scene> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.