From 0ad238a5082a978e463d2b25acb28215a3f0e1d0 Mon Sep 17 00:00:00 2001 From: James Pollack Date: Tue, 22 Sep 2015 12:39:48 -0700 Subject: [PATCH] Enlarge flashlight --- examples/toys/flashlight/createFlashlight.js | 8 +++---- examples/toys/flashlight/flashlight.js | 24 ++++++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/examples/toys/flashlight/createFlashlight.js b/examples/toys/flashlight/createFlashlight.js index 65cafbcdaa..38907efa75 100644 --- a/examples/toys/flashlight/createFlashlight.js +++ b/examples/toys/flashlight/createFlashlight.js @@ -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', diff --git a/examples/toys/flashlight/flashlight.js b/examples/toys/flashlight/flashlight.js index 7f2bd210da..f5929dcfc8 100644 --- a/examples/toys/flashlight/flashlight.js +++ b/examples/toys/flashlight/flashlight.js @@ -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); }, };