-
Notifications
You must be signed in to change notification settings - Fork 67
/
physX.html
115 lines (91 loc) · 3.3 KB
/
physX.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
<!DOCTYPE html>
<html>
<head>
<title>A-Frame: Physics</title>
<meta name="description" content="A-Frame Physics">
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">
<script src="js/aframe-v1.3.0.js"></script>
<script src="js/aframe-environment-component.js"></script>
<script src="js/physx.release.js"></script>
<script src="js/physics.js"></script>
</head>
<body>
<a-scene environment="preset: default;" physx="autoLoad: true; delay: 1000; wasmUrl: js/physx.release.wasm; useDefaultScene: false;">
<a-assets>
<img id="crate" src="images/crate.jpg" />
<img id="pixels" src="images/pixels.png" />
<img id="ball" src="images/basketball-gray.png" />
<img id="hexagons" src="images/hexagons.png"/>
</a-assets>
<!-- camera -->
<a-entity camera look-controls wasd-controls="acceleration: 4" position="0 1.6 0"></a-entity>
<!-- Floor -->
<a-box physx-body="type: static;"
position="0 0.02 0"
width="20" depth="20" height="0.1"
material="src: #crate; repeat: 10 10;">
</a-box>
<!-- Walls -->
<a-box physx-body="type: static;"
position="0 0.51 -10"
width="20" depth="0.1" height="1"
material="src: #crate; repeat: 10 10;">
</a-box>
<a-box physx-body="type: static;"
position="0 0.51 10"
width="20" depth="0.1" height="1"
material="src: #crate; repeat: 10 10;">
</a-box>
<a-box physx-body="type: static;"
position="10 0.51 0"
width="0.1" depth="20" height="1"
material="src: #crate; repeat: 10 10;">
</a-box>
<a-box physx-body="type: static;"
position="-10 0.51 0"
width="0.1" depth="20" height="1"
material="src: #crate; repeat: 10 10;">
</a-box>
<!-- Dynamic objects -->
<a-box physx-body="type: dynamic;"
position="-5 3 -5" rotation="10 20 30"
material="src:#crate;">
</a-box>
<a-cylinder physx-body="type: dynamic;"
position="-3 3 -5" rotation="5 10 15"
radius="0.25" height="1"
material="src: #hexagons">
</a-cylinder>
<a-entity physx-body="type: dynamic;"
geometry="primitive: icosahedron; radius: 0.5;"
position="-1 3 -5" rotation="53 37 42"
material="src: #pixels; repeat: 10 10;">
</a-entity>
<a-sphere physx-body="type: dynamic;" physx-material="restitution: 0.8;"
position="1 6 -5"
radius="0.5"
material="src:#ball; color:red;">
</a-sphere>
<a-sphere physx-body="type: dynamic;" physx-material="restitution: 0.8;"
position="2.5 6 -5.1"
radius="0.5"
material="src:#ball; color:orange;">
</a-sphere>
<a-sphere physx-body="type: dynamic;" physx-material="restitution: 0.8;"
position="3 4 -5"
radius="0.5"
material="src:#ball; color:yellow;">
</a-sphere>
<a-sphere physx-body="type: dynamic;" physx-material="restitution: 0.8;"
position="3.5 8 -4.8"
radius="0.5"
material="src:#ball; color:green;">
</a-sphere>
<a-sphere physx-body="type: dynamic;" physx-material="restitution: 0.8;"
position="5 2 -5"
radius="0.5"
material="src:#ball; color:blue;">
</a-sphere>
</a-scene>
</body>
</html>