forked from SLI-UNIL/Outdoor-bowling-vr-experience
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
230 lines (185 loc) · 9.88 KB
/
index.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Outdoor Bowling</title>
<script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-environment-component/dist/aframe-environment-component.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/c-frame/[email protected]/dist/aframe-physics-system.min.js"></script>
<script src="main.js"></script>
</head>
<body>
<!-- Main scene -->
<a-scene physics="gravity: -9.81;" loading-screen="dotsColor: black; backgroundColor: darkseagreen">
<!-- Assets -->
<a-assets>
<!-- Models -->
<a-asset-item id="bowling-pin" src="./assets/models/Pin.obj"></a-asset-item>
<a-asset-item id="bowling-pin-mtl" src="./assets/models/Pin.mtl"></a-asset-item>
<a-asset-item id="chair" src="./assets/models/deck_chair.obj"></a-asset-item>
<a-asset-item id="coffee-table" src="./assets/models/coffee_table.obj"></a-asset-item>
<a-asset-item id="rack" src="./assets/models/Rack.obj"></a-asset-item>
<a-asset-item id="radio" src="./assets/models/Vintage_soviet_radio.obj"></a-asset-item>
<a-asset-item id="palette" src="./assets/models/Palette_garden_table.obj"></a-asset-item>
<a-asset-item id="palette-mtl" src="./assets/models/Palette_garden_table.mtl"></a-asset-item>
<a-asset-item id="pizza-gltf" src="./assets/models/pizza/scene.gltf"></a-asset-item>
<a-asset-item id="wine" src="./assets/models/wine/scene.gltf"></a-asset-item>
<!-- Textures -->
<img id="ball-texture" src="./assets/img/texture.png">
<img id="ball-texture-2" src="./assets/img/ball_green.jpg">
<img id="ball-texture-3" src="./assets/img/ball_orange.jpg">
<img id="wooden-floor" src="./assets/img/BowlingWood_baseColor.png">
<img id="radio-texture" src ="./assets/img/Radio_rodina_BaceColor.png">
<img id="table-texture" src ="./assets/img/Cherry_honey.png">
<img id="wood" src ="./assets/img/wood.jpg">
<img id="chair-wood" src ="./assets/img/chair_wood.jpg">
<img id="chair-wood-2" src ="./assets/img/brown-wooden-texture-flooring-background.jpg">
<!-- Sounds -->
<audio id="strike" src="./assets/sfx/bowling_strike.mp3" preload="auto"></audio>
<audio id="roll" src="./assets/sfx/bowling_roll.mp3" preload="auto"></audio>
<audio id="music" src="./assets/sfx/jazz.mp3" preload="auto"></audio>
</a-assets>
<!-- Environment -->
<a-entity environment="preset: forest; ground: flat; skyType: gradient; skyColor: orange;"></a-entity>
<!-- Achievements list -->
<a-entity
id="achievementList"
text="value: Achievements:\n( none yet ); width: 4; align: center; color: black; side: double;"
position="-8 3 20"
rotation="0 90 0">
</a-entity>
<!-- Ground -->
<a-plane static-body rotation="-90 0 0" position="0 -0.1 0" width="100" height="100"></a-plane>
<!-- Bowling lane -->
<a-box static-body src="#wooden-floor" depth="30" height="0.2" width="5" rotation="0 0 0" position="0 0 0"></a-box>
<!-- Ball -->
<a-sphere apply-force play-sound position-handler id="theBall" src="#ball-texture" dynamic-body segmentsWidth="5" radius="0.4" position="0 0.5 13" mass="10" sound="src: #roll; on: click; volume: 1;" unlock-achievement="name: Throw the ball!"></a-sphere>
<!-- Table with radio on it -->
<a-entity obj-model="obj: #coffee-table;" material="src: #table-texture;" position="6 0 17" scale=".03 .03 .03" rotation="0 -135 0"></a-entity>
<!-- Ball rack -->
<a-entity obj-model="obj: #rack;" material="src: #table-texture;" position="-8 0 18" rotation="-90 45 0" scale="0.1 0.1 0.1"></a-entity>
<!-- Radio and text -->
<a-entity position="6 3.5 17.5" text="value: Click on the radio for some sweet tunes!; color: black; width: 10; side: double;" rotation="0 -45 0"></a-entity>
<a-entity play-button obj-model="obj: #radio;" material="src: #radio-texture;" position="6 2.5 17" rotation="0 -45 0" scale=".5 .5 .5" sound="src: #music; volume: 0.5;" unlock-achievement="name: Listen to some music."></a-entity>
<!-- Palette with food and drinks -->
<a-entity obj-model="obj: #palette; mtl: #palette-mtl;" position="0 0 25" rotation="0 90 0" scale="3 3 3"></a-entity>
<a-entity gltf-model="#pizza-gltf" position="0 1.1 25" scale="4 2 4"></a-entity>
<a-entity gltf-model="#wine" position="0.5 1.1 26" rotation="0 120 0"></a-entity>
<!-- Bowling balls and text-->
<a-sphere reload radius="0.4" position="-5.5 3.5 14.5" material=" src: #ball-texture-2;" unlock-achievement="name: Change your bowling ball."></a-sphere>
<a-sphere reload radius="0.4" position="-6.5 2.3 15.5" material=" src: #ball-texture;" unlock-achievement="name: Change your bowling ball."></a-sphere>
<a-sphere reload radius="0.4" position="-7.5 1.1 16.5" material=" src: #ball-texture-3;" unlock-achievement="name: Change your bowling ball."></a-sphere>
<a-entity position="-5 5 15" text="value: Take a bowling ball!; color: black; width: 6; side: double;" rotation="0 45 0"></a-entity>
<!-- Chairs -->
<a-entity dynamic-body obj-model="obj: #chair;" material="src: #chair-wood-2;" position="-6 0 25" rotation="0 0 0" scale="2.5 2.5 2.5"></a-entity>
<a-entity dynamic-body obj-model="obj: #chair;" material="src: #chair-wood-2;" position="-3 0 29" rotation="0 45 0" scale="2.5 2.5 2.5"></a-entity>
<a-entity dynamic-body obj-model="obj: #chair;" material="src: #chair-wood-2;" position="6 0 25" rotation="0 180 0" scale="2.5 2.5 2.5"></a-entity>
<a-entity dynamic-body obj-model="obj: #chair;" material="src: #chair-wood-2;" position="3 0 29" rotation="0 135 0" scale="2.5 2.5 2.5"></a-entity>
<!-- Bowling pins -->
<a-entity obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 5; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position="-1.5 0 -14"
scale=".5 .5 .5">
</a-entity>
<a-entity obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 5; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position="-.5 0 -14"
scale=".5 .5 .5">
</a-entity>
<a-entity obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 5; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position=".5 0 -14"
scale=".5 .5 .5">
</a-entity>
<a-entity obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 5; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position="1.5 0 -14"
scale=".5 .5 .5">
</a-entity>
<a-entity obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 5; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position="-1 0 -13"
scale=".5 .5 .5">
</a-entity>
<a-entity obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 5; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position="0 0 -13"
scale=".5 .5 .5">
</a-entity>
<a-entity obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 2; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position="1 0 -13"
scale=".5 .5 .5">
</a-entity>
<a-entity obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 2; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position="-.5 0 -12"
scale=".5 .5 .5">
</a-entity>
<a-entity obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 2; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position=".5 0 -12"
scale=".5 .5 .5">
</a-entity>
<a-entity id="pin" obj-model="obj: #bowling-pin; mtl: #bowling-pin-mtl"
body="type: dynamic; mass: 2; shape: none;"
shape__main="shape: cylinder;
height: 4;
radiusTop: 0.6;
radiusBottom: 0.6;
offset: 0 2 0;"
position="0 0 -11"
scale=".5 .5 .5">
</a-entity>
<a-camera look-controls position="-10 4 40" rotation="0 0 0">
<a-cursor></a-cursor>
</a-camera>
</a-scene>
</body>
</html>