Merge pull request #6323 from ericrius1/eraseBoardFix

Fixed bug where eraser wouldn't erase
This commit is contained in:
Seth Alves 2015-11-05 14:25:10 -08:00
commit 29ce1d50ae

View file

@ -87,12 +87,24 @@ var light = Entities.addEntity({
type: 'Light', type: 'Light',
name: 'whiteboard light', name: 'whiteboard light',
position: lightPosition, position: lightPosition,
dimensions: {x: 10, y: 10, z: 10}, dimensions: {
x: 10,
y: 10,
z: 10
},
intensity: 2, 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)); eraserPosition = Vec3.sum(eraserPosition, Vec3.multiply(-0.1, rotation));
scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); scriptURL = Script.resolvePath("eraseBoardEntityScript.js");
var eraser = Entities.addEntity({ var eraser = Entities.addEntity({
@ -103,7 +115,10 @@ var eraser = Entities.addEntity({
script: scriptURL, script: scriptURL,
rotation: rotation, rotation: rotation,
userData: JSON.stringify({ userData: JSON.stringify({
whiteboard: drawingSurface whiteboard: drawingSurface,
grabbableKey: {
wantsTrigger: true
}
}) })
}); });
@ -115,20 +130,32 @@ Script.setTimeout(function() {
function setUp() { 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))); blockerPosition = Vec3.sum(blockerPosition, Vec3.multiply(-1, Quat.getFront(rotation)));
blocker = Entities.addEntity({ blocker = Entities.addEntity({
type: "Box", type: "Box",
rotation: rotation, rotation: rotation,
position: blockerPosition, position: blockerPosition,
dimensions: {x: whiteboardDimensions.x, y: 1, z: 0.1}, dimensions: {
x: whiteboardDimensions.x,
y: 1,
z: 0.1
},
shapeType: "box", shapeType: "box",
visible: false visible: false
}); });
var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions; var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions;
Entities.editEntity(eraser, {dimensions: eraseModelDimensions}); Entities.editEntity(eraser, {
Entities.editEntity(colorIndicatorBorder, {dimensions: colorIndicatorBorderDimensions}); dimensions: eraseModelDimensions
});
Entities.editEntity(colorIndicatorBorder, {
dimensions: colorIndicatorBorderDimensions
});
scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); scriptURL = Script.resolvePath("colorIndicatorEntityScript.js");
var colorIndicatorPosition = Vec3.sum(center, { var colorIndicatorPosition = Vec3.sum(center, {
@ -193,7 +220,9 @@ function setUp() {
userData: JSON.stringify({ userData: JSON.stringify({
whiteboard: drawingSurface, whiteboard: drawingSurface,
colorIndicator: colorIndicatorBox, colorIndicator: colorIndicatorBox,
grabbableKey: {wantsTrigger: true} grabbableKey: {
wantsTrigger: true
}
}) })
}); });
colorBoxes.push(colorBox); colorBoxes.push(colorBox);
@ -218,4 +247,4 @@ function cleanup() {
// Uncomment this line to delete whiteboard and all associated entity on script close // Uncomment this line to delete whiteboard and all associated entity on script close
// Script.scriptEnding.connect(cleanup); // Script.scriptEnding.connect(cleanup);