Enlarge flashlight

This commit is contained in:
James Pollack 2015-09-22 12:39:48 -07:00
parent bf22d5a942
commit 0ad238a508
2 changed files with 24 additions and 8 deletions
examples/toys/flashlight

View file

@ -15,7 +15,7 @@
Script.include("https://hifi-public.s3.amazonaws.com/scripts/utilities.js");
var scriptURL = Script.resolvePath('flashlight.js');
var scriptURL = Script.resolvePath('flashlight.js?123123');
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
@ -30,9 +30,9 @@ var flashlight = Entities.addEntity({
modelURL: modelURL,
position: center,
dimensions: {
x: 0.04,
y: 0.15,
z: 0.04
x: 0.08,
y: 0.30,
z: 0.08
},
collisionsWillMove: true,
shapeType: 'box',

View file

@ -33,7 +33,7 @@
// These constants define the Spotlight position and orientation relative to the model
var MODEL_LIGHT_POSITION = {
x: 0,
y: 0,
y: -0.3,
z: 0
};
var MODEL_LIGHT_ROTATION = Quat.angleAxis(-90, {
@ -117,6 +117,21 @@
cutoff: 90, // in degrees
});
this.debugBox = Entities.addEntity({
type: 'Box',
color: {
red: 255,
blue: 0,
green: 0
},
dimensions: {
x: 0.25,
y: 0.25,
z: 0.25
},
ignoreForCollisions:true
})
this.hasSpotlight = true;
}
@ -166,6 +181,10 @@
rotation: glowLightTransform.q,
})
// Entities.editEntity(this.debugBox, {
// position: lightTransform.p,
// rotation: lightTransform.q,
// })
},
changeLightWithTriggerPressure: function(flashLightHand) {
@ -184,7 +203,6 @@
return
},
turnLightOff: function() {
print('turn light off')
Entities.editEntity(this.spotlight, {
intensity: 0
});
@ -194,7 +212,6 @@
this.lightOn = false
},
turnLightOn: function() {
print('turn light on')
Entities.editEntity(this.glowLight, {
intensity: 2
});
@ -227,7 +244,6 @@
}
Script.update.disconnect(this.update);
},
};