/
proximitytoobject.html
32 lines (26 loc) · 1.31 KB
/
proximitytoobject.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
<!DOCTYPE html>
<html>
<head>
<title>A-Frame Proxemics - Distance Sensor</title>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-environment-component/dist/aframe-environment-component.min.js"></script>
<script src="https://unpkg.com/aframe-event-set-component@^4.0.0/dist/aframe-event-set-component.min.js"></script>
<script src="../../dist/aframe-proxemic-component.js"></script>
</head>
<body>
<a-scene environment="preset: forest" stats>
<a-sphere proximity-sensor="target:#two; distance: 1"
radius="0.25" id="one" side="both" color="green" position="-2 1.6 -4"
animation="property:position; from: -2 1.6 -4; to: 2 1.6 -4; dur: 5000; dir: alternate; loop: true"
event-set__proximityenter="material.color: red"
event-set__proximityexit="material.color: green"
></a-sphere>
<a-box proximity-sensor="target:#one; distance: 2"
width="0.5" height="0.5" depth="0.5" id="two" side="both" color="green" position="2 1.6 -4"
animation="property:position; from: 2 1.6 -4; to: -2 1.6 -4; dur: 5000; dir: alternate; loop: true"
event-set__proximityenter="material.color:blue"
event-set__proximityexit="material.color: green"
></a-box>
</a-scene>
</body>
</html>