-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
58 lines (54 loc) · 2.22 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
<!-- This is structure is largely based on the arJS documentation examples, -->
<!-- which can be found at the following URL: -->
<!-- https://ar-js-org.github.io/AR.js-Docs/ -->
<!DOCTYPE html>
<html>
<head>
<!-- Including AFrame, arJS and custom JavaScript file -->
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js"></script>
<script src="main.js"></script>
</head>
<body style="margin : 0px; overflow: hidden;">
<a-scene embedded arjs>
<!-- Including the first game piece, setting the model, attack defense properties, and checking for mouse click events -->
<a-marker preset="kanji">
<a-entity
position="0 0 0"
scale="0.5 0.5 0.5"
gltf-model="/knight/knight.glb"
collider-check="attack: 2; defense: 5"
class="collidable"
markerhandler
cursor="rayOrigin: mouse"
emitevents="true"
>
<!-- Including raycaster that scans for collidable objects, together with the game stats UI -->
<a-entity raycaster="objects: .collidable"></a-entity>
<a-text color="white" position="-0.5 2.0 0" value="Attack: 2"></a-text>
<a-text color="white" position="-0.5 1.8 0" value="Defense: 5"></a-text>
</a-entity>
</a-marker>
<!-- The second game piece, using similar logic to the first one but with different values -->
<a-marker preset="hiro">
<a-entity
position="0 0 0"
scale="0.5 0.5 0.5"
rotation="0 0 0"
gltf-model="/samus/samus.glb"
collider-check="attack: 5; defense: 3"
class="collidable"
markerhandler
cursor="rayOrigin: mouse"
emitevents="true"
>
<a-entity raycaster="objects: .collidable" position="0 0 0" rotation="0 180 0"></a-entity>
<a-text color="white" position="-0.5 2.0 0" value="Attack: 5"></a-text>
<a-text color="white" position="-0.5 1.8 0" value="Defense: 3"></a-text>
</a-entity>
</a-marker>
<!-- Main viewport for the player -->
<a-entity camera></a-entity>
</a-scene>
</body>
</html>