forked from stemkoski/A-Frame-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
physics.html
64 lines (38 loc) · 2.6 KB
/
physics.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
<!DOCTYPE html>
<html>
<head>
<title>A-Frame: Physics component</title>
<meta name="description" content="A-Frame Examples">
<script src="js/aframe-master.1.0.4.min.js"></script>
<script src="js/aframe-environment-component.min-old.js"></script>
<script src="js/aframe-physics-system.min.js"></script>
</head>
<body>
<!-- https://github.com/supermedium/aframe-environment-component
<a-scene environment="preset: default;"> -->
<a-scene environment="preset: default;" physics="debug: true;">
<a-assets>
<img id="crate" src="images/crate.jpg" />
<img id="pixels" src="images/pixels.png" />
<img id="ball" src="images/basketball-gray.png" />
</a-assets>
<!-- camera -->
<a-entity camera look-controls wasd-controls="acceleration:10" position="0 1.6 0"></a-entity>
<!-- Floor -->
<a-plane static-body position="0 0.02 0" rotation="90 0 0" width="20" height="20" material="src: #crate; repeat: 10 10; transparent: true; opacity: 0.5; side:double;"></a-plane>
<a-plane static-body position="0 0.51 -10" rotation="0 0 0" width="20" height="1" material="src: #crate; repeat: 20 1; transparent: true; opacity: 0.5; side:double;"></a-plane>
<a-plane static-body position="0 0.51 10" rotation="0 0 0" width="20" height="1" material="src: #crate; repeat: 20 1; transparent: true; opacity: 0.5; side:double;"></a-plane>
<a-plane static-body position="-10 0.51 0" rotation="0 90 0" width="20" height="1" material="src: #crate; repeat: 20 1; transparent: true; opacity: 0.5; side:double;"></a-plane>
<a-plane static-body position="10 0.51 0" rotation="0 90 0" width="20" height="1" material="src: #crate; repeat: 20 1; transparent: true; opacity: 0.5; side:double;"></a-plane>
<!-- Dynamic objects -->
<a-box dynamic-body position="-5 3 -5" rotation="10 20 30" material="src:#crate;"></a-box>
<a-cylinder dynamic-body position="-3 3 -5" rotation="5 10 15" radius="0.25" height="1" color="cyan"></a-cylinder>
<a-entity dynamic-body="shape: hull;" geometry="primitive: icosahedron; radius: 0.5;" position="-1 3 -5" material="src: #pixels; repeat: 10 10;"></a-entity>
<a-sphere dynamic-body position="1 6 -5" radius="0.5" material="src:#ball; color:red;"></a-sphere>
<a-sphere dynamic-body position="2.5 6 -5.1" radius="0.5" material="src:#ball; color:orange;"></a-sphere>
<a-sphere dynamic-body position="3 4 -5" radius="0.5" material="src:#ball; color:yellow;"></a-sphere>
<a-sphere dynamic-body position="3.5 8 -4.8" radius="0.5" material="src:#ball; color:green;"></a-sphere>
<a-sphere dynamic-body position="5 2 -5" radius="0.5" material="src:#ball; color:blue;"></a-sphere>
</a-scene>
</body>
</html>