From f8de01a856c3e5e85da6e2e2a322b32669eec911 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 5 Nov 2015 14:14:49 -0800 Subject: [PATCH] Fixed bug where eraser wouldn't erase --- .../painting/whiteboard/whiteboardSpawner.js | 49 +++++++++++++++---- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 53bb7158d5..56ead143e4 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -87,12 +87,24 @@ var light = Entities.addEntity({ type: 'Light', name: 'whiteboard light', position: lightPosition, - dimensions: {x: 10, y: 10, z: 10}, + dimensions: { + x: 10, + y: 10, + z: 10 + }, intensity: 2, - color: {red: 255, green: 255, blue: 255} + color: { + red: 255, + green: 255, + blue: 255 + } }); -var eraserPosition = Vec3.sum(center, {x: 0, y: 2.05, z: 0 }); +var eraserPosition = Vec3.sum(center, { + x: 0, + y: 2.05, + z: 0 +}); eraserPosition = Vec3.sum(eraserPosition, Vec3.multiply(-0.1, rotation)); scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); var eraser = Entities.addEntity({ @@ -103,7 +115,10 @@ var eraser = Entities.addEntity({ script: scriptURL, rotation: rotation, userData: JSON.stringify({ - whiteboard: drawingSurface + whiteboard: drawingSurface, + grabbableKey: { + wantsTrigger: true + } }) }); @@ -115,20 +130,32 @@ Script.setTimeout(function() { function setUp() { - var blockerPosition = Vec3.sum(center, {x: 0, y: -1, z: 0 }); + var blockerPosition = Vec3.sum(center, { + x: 0, + y: -1, + z: 0 + }); blockerPosition = Vec3.sum(blockerPosition, Vec3.multiply(-1, Quat.getFront(rotation))); blocker = Entities.addEntity({ type: "Box", rotation: rotation, position: blockerPosition, - dimensions: {x: whiteboardDimensions.x, y: 1, z: 0.1}, + dimensions: { + x: whiteboardDimensions.x, + y: 1, + z: 0.1 + }, shapeType: "box", visible: false }); var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions; - Entities.editEntity(eraser, {dimensions: eraseModelDimensions}); - Entities.editEntity(colorIndicatorBorder, {dimensions: colorIndicatorBorderDimensions}); + Entities.editEntity(eraser, { + dimensions: eraseModelDimensions + }); + Entities.editEntity(colorIndicatorBorder, { + dimensions: colorIndicatorBorderDimensions + }); scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); var colorIndicatorPosition = Vec3.sum(center, { @@ -193,7 +220,9 @@ function setUp() { userData: JSON.stringify({ whiteboard: drawingSurface, colorIndicator: colorIndicatorBox, - grabbableKey: {wantsTrigger: true} + grabbableKey: { + wantsTrigger: true + } }) }); colorBoxes.push(colorBox); @@ -218,4 +247,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -// Script.scriptEnding.connect(cleanup); +// Script.scriptEnding.connect(cleanup); \ No newline at end of file