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

View file

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

View file

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