This repository was archived by the owner on May 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathconstraints-ammo.html
120 lines (114 loc) · 4.98 KB
/
constraints-ammo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<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 • Constraints • AmmoDriver</title>
<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="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="../dist/aframe-physics-system.js"></script>
</head>
<body>
<a-scene environment physics="driver: ammo; debug: true">
<a-entity id="cameraRig">
<a-camera></a-camera>
<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;"
hand-controls="hand: left">
</a-entity>
<a-entity teleport-controls="cameraRig: #cameraRig; button: trigger"
ammo-body="type: kinematic"
ammo-shape="type: box; halfExtents: 0.05 0.1 0.1; fit: manual;"
hand-controls="hand: right">
</a-entity>
</a-entity>
<!-- CONE TWIST -->
<a-entity position="2 0 -1">
<a-text value="Cone Twist" position="0 1.5 0" align="center"></a-text>
<a-sphere id="conetwist-target" radius="0.125" color="#777" position="0 1 0"
ammo-body="type: static" ammo-shape="type: sphere">
</a-sphere>
<a-box width="0.25" height="0.25" depth="0.25" color="#F00"
ammo-body ammo-shape
ammo-constraint="type: coneTwist;
target: #conetwist-target;
pivot: 0.13 0 0.0;
targetPivot: -0.13 0.0 0.0;
axis: 1.0 0.0 0.0;
targetAxis: 1.0 0.0 0.0">
</a-box>
</a-entity>
<!-- HINGE -->
<a-entity position="-2 0 -1">
<a-text value="Hinge" position="0 1.5 0" align="center"></a-text>
<a-box id="hinge-target" position="-0.25 1 0.0" color="#777" ammo-body="type: static" ammo-shape scale="0.25 0.25 0.25"></a-box>
<a-box depth="0.1"
color="#F00"
scale="0.25 0.25 0.25"
ammo-body ammo-shape
ammo-constraint="type: hinge;
target: #hinge-target;
axis: 0 1 0;
targetAxis: 0 1 0;
pivot: -0.125 0 0;
targetPivot: 0.125 0 0.125;">
</a-box>
<a-box position="0.26 1 0" scale="0.25 0.25 0.25" color="#777" ammo-body="type: static" ammo-shape></a-box>
</a-entity>
<!-- LOCK -->
<a-entity position="0 0 -1">
<a-text value="Lock" position="0 1.5 0" align="center"></a-text>
<a-box id="lock-target"
position="0 1.0 0"
scale="0.25 0.25 0.25"
color="#777"
ammo-body="type: static" ammo-shape>
</a-box>
<a-box color="#F00"
position="0 1.25 0"
scale="0.25 0.25 0.25"
ammo-body ammo-shape
ammo-constraint="type: lock; target: #lock-target">
</a-box>
</a-entity>
<!-- POINT TO POINT -->
<a-entity position="4 0 -1">
<a-text value="Point to Point" position="0 1.5 0" align="center"></a-text>
<a-box id="pointtopoint-target"
color="#777"
position="0 1 0"
scale="0.25 0.25 0.25"
ammo-body="type: static" ammo-shape>
</a-box>
<a-box color="#F00"
scale="0.25 0.25 0.25"
ammo-body ammo-shape
ammo-constraint="type: pointToPoint;
target: #pointtopoint-target;
pivot: -0.125 -0.125 0.125;
targetPivot: 0.125 -0.125 0.125">
</a-box>
</a-entity>
<!-- SLIDER -->
<a-entity position="-4 0 -1">
<a-text value="Slider" position="0 1.5 0" align="center"></a-text>
<a-sphere id="slider-target"
radius="0.125"
position="-0.5 1 0"
color="#777"
ammo-body="type: static" ammo-shape>
</a-sphere>
<a-sphere color="#F00"
radius="0.125"
position="0 1 0"
ammo-body ammo-shape
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>
</a-entity>
</a-scene>
</body>
</html>