52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
|
|
|
|
(function () {
|
|
|
|
var stateSignalBox = null;
|
|
var pos = Vec3.sum(Quat.getFront(Camera.orientation), Camera.position);
|
|
var oldIsSitting = false;
|
|
|
|
stateSignalBox = Entities.addEntity({
|
|
color: {
|
|
"blue": 20,
|
|
"green": 200,
|
|
"red": 20
|
|
},
|
|
type: "Box",
|
|
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
|
|
userData: "{\"grabbableKey\":{\"grabbable\":true}}",
|
|
position: pos,
|
|
rotation: Camera.orientation
|
|
}, false);
|
|
|
|
|
|
Script.update.connect(function () {
|
|
|
|
if (MyAvatar.isInSittingState) {
|
|
stateSignalBox = Entities.editEntity(stateSignalBox, {
|
|
"color": {
|
|
"blue": 20,
|
|
"green": 20,
|
|
"red": 200
|
|
}
|
|
});
|
|
} else {
|
|
stateSignalBox = Entities.editEntity(stateSignalBox, {
|
|
"color": {
|
|
"blue": 20,
|
|
"green": 200,
|
|
"red": 20
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
Script.scriptEnding.connect(function() {
|
|
print("script ending");
|
|
Entities.deleteEntity(stateSignalBox);
|
|
});
|
|
|
|
|
|
// end scope
|
|
}());
|
|
|