-
Notifications
You must be signed in to change notification settings - Fork 0
/
whereishereNOTES
79 lines (53 loc) · 1.8 KB
/
whereishereNOTES
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
Where is Here?
NOTES
worldPos.copy( worldPos ).add( new THREE.Vector3(0, 0, -2) );
intPosition = worldPos
worldPos.copy( worldPos ).add( new THREE.Vector3(0, 0, -2) );
<script>
function randomPointOnCircle(radius, angleRad) {
x = Math.cos(angleRad)*radius;
y = Math.sin(angleRad)*radius;
return {x: x, y: y};
}
// Define custom schema for syncing avatar color, set by random-color
var avatarSchema = {
template: '#avatar-template',
components: [
'position',
'rotation',
{
selector: '.head',
component: 'material'
}
]
};
NAF.schemas.add(avatarSchema);
// Called by Networked-Aframe when connected to server
function onConnect () {
// Get random angle
var angleRad = Math.random()*Math.PI*2;
// Get position around a circle
var position = randomPointOnCircle(3, angleRad);
var positionStr = position.x + ' 1.3 ' + position.y;
// Get rotation towards center of circle
var angleDeg = angleRad * 180 / Math.PI;
var angleToCenter = -1 * angleDeg + 90;
var rotationStr = '0 ' + angleToCenter + ' 0';
// Create avatar with this position and rotation
NAF.entities.createAvatar('#avatar-template', positionStr, rotationStr);
}
</script>
network-scene="
app: whereishere;
room: where;
audio: false;
debug: true;
signallingUrl: http://haydenlee.io;
">
var spawnOffset = -103 2 26.67
var positionStr2 = var positionStr.x
<!-- Clickring Offset -->
var x = evt.detail.intersection.point.x + -5;
var y = evt.detail.intersection.point.y;
var z = evt.detail.intersection.point.z;
clickRing.setAttribute('position', `${x} ${y} ${z}`);