mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 12:35:21 +02:00
toggle light switch
This commit is contained in:
parent
153a30de0d
commit
81c175eabf
3 changed files with 20 additions and 6 deletions
|
@ -54,11 +54,10 @@
|
|||
|
||||
// flip model to give illusion of light switch being flicked
|
||||
var rotation = Entities.getEntityProperties(this.entityID, "rotation").rotation;
|
||||
var axis = Quat.axis(rotation);
|
||||
var angle = Quat.angle(rotation);
|
||||
var axis = {x: 0, y: 1, z: 0};
|
||||
var dQ = Quat.angleAxis(180, axis);
|
||||
rotation = Quat.multiply(rotation, dQ);
|
||||
|
||||
angle += 180;
|
||||
rotation = Quat.angleAxis(angle, axis);
|
||||
|
||||
Entities.editEntity(this.entityID, {
|
||||
rotation: rotation
|
||||
|
|
|
@ -52,6 +52,21 @@
|
|||
this.createLights();
|
||||
}
|
||||
|
||||
// flip model to give illusion of light switch being flicked
|
||||
var rotation = Entities.getEntityProperties(this.entityID, "rotation").rotation;
|
||||
var axis = {
|
||||
x: 0,
|
||||
y: 1,
|
||||
z: 0
|
||||
};
|
||||
var dQ = Quat.angleAxis(180, axis);
|
||||
rotation = Quat.multiply(rotation, dQ);
|
||||
|
||||
|
||||
Entities.editEntity(this.entityID, {
|
||||
rotation: rotation
|
||||
});
|
||||
|
||||
Audio.playSound(this.switchSound, {
|
||||
volume: 0.5,
|
||||
position: this.position
|
||||
|
@ -104,7 +119,7 @@
|
|||
var sconceLight2 = Entities.addEntity({
|
||||
type: "Light",
|
||||
position: {
|
||||
x: 540.1 ,
|
||||
x: 540.1,
|
||||
y: 496.24,
|
||||
z: 505.57
|
||||
},
|
||||
|
|
|
@ -191,7 +191,7 @@ function createFlashlight(position) {
|
|||
}
|
||||
|
||||
function createLightSwitches() {
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/dimmer.fbx";
|
||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx?v1";
|
||||
var scriptURL = Script.resolvePath("lightSwitchHall.js?v1");
|
||||
|
||||
var lightSwitchHall = Entities.addEntity({
|
||||
|
|
Loading…
Reference in a new issue