-
Notifications
You must be signed in to change notification settings - Fork 1
/
makiversion.js
30 lines (26 loc) · 902 Bytes
/
makiversion.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
(function(){
var _this = this;
var changeColor = function(entityID){
var displacementDist = 0.1;
var entity = Entities.getEntityProperties(entityID, ["position"]);
Entities.editEntity(entityID, {
color: {
red: Math.random()*255,
green: Math.random()*255,
blue: Math.random()*255,
},
position: Vec3.sum(entity.position, {
x: (Math.random()-0.5)*2*displacementDist,
y: (Math.random()-0.5)*2*displacementDist,
z: (Math.random()-0.5)*2*displacementDist,
}),
});
};
_this.preload = function(){
print("Loaded script");
};
_this.clickDownOnEntity = function(entityID, event){
print("I was clicked (yes, me)!");
changeColor(entityID);
};
})