-
Notifications
You must be signed in to change notification settings - Fork 502
/
Copy pathzoneEntityExample.js
72 lines (62 loc) · 1.84 KB
/
zoneEntityExample.js
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
//
// zoneEntityExample.js
// examples
//
// Created by Brad Hefta-Gaub on 4/16/15.
// Copyright 2015 High Fidelity, Inc.
//
// This is an example script that demonstrates creating and editing a entity
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
var count = 0;
var stopAfter = 1000;
var zoneEntityA = Entities.addEntity({
type: "Zone",
position: { x: 5, y: 5, z: 5 },
dimensions: { x: 10, y: 10, z: 10 },
keyLightColor: { red: 255, green: 0, blue: 0 },
stageSunModelEnabled: false,
keyLightDirection: { x: 0, y: -1.0, z: 0 },
shapeType: "sphere"
});
print("zoneEntityA:" + zoneEntityA);
var zoneEntityB = Entities.addEntity({
type: "Zone",
position: { x: 5, y: 5, z: 5 },
dimensions: { x: 2, y: 2, z: 2 },
keyLightColor: { red: 0, green: 255, blue: 0 },
keyLightIntensity: 0.9,
stage: {
latitude: 37.777,
longitude: 122.407,
altitude: 0.03,
day: 60,
hour: 0,
sunModelEnabled: true
}
});
print("zoneEntityB:" + zoneEntityB);
var zoneEntityC = Entities.addEntity({
type: "Zone",
position: { x: 5, y: 10, z: 5 },
dimensions: { x: 10, y: 10, z: 10 },
keyLightColor: { red: 0, green: 0, blue: 255 },
keyLightIntensity: 0.75,
keyLightDirection: { x: 0, y: 0, z: -1 },
stageSunModelEnabled: false,
shapeType: "compound",
compoundShapeURL: "http://headache.hungry.com/~seth/hifi/cube.fbx"
});
print("zoneEntityC:" + zoneEntityC);
// register the call back so it fires before each data send
Script.update.connect(function(deltaTime) {
// stop it...
if (count >= stopAfter) {
print("calling Script.stop()");
Script.stop();
}
count++;
});