From 641b9e8253fdc474ad9f077358c3c3be64702915 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 19 Jun 2014 10:43:25 -0700 Subject: [PATCH 1/5] Set minimum angular size too model selection --- examples/editModels.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/editModels.js b/examples/editModels.js index eebcd075fa..d2670f59bf 100644 --- a/examples/editModels.js +++ b/examples/editModels.js @@ -34,6 +34,7 @@ var LASER_COLOR = { red: 255, green: 0, blue: 0 }; var LASER_LENGTH_FACTOR = 500 ; +var MIN_ANGULAR_SIZE = 2; var MAX_ANGULAR_SIZE = 45; var LEFT = 0; @@ -828,8 +829,9 @@ function mousePressEvent(event) { var X = Vec3.sum(A, Vec3.multiply(B, x)); var d = Vec3.length(Vec3.subtract(P, X)); - if (0 < x && x < LASER_LENGTH_FACTOR) { - if (2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14 < MAX_ANGULAR_SIZE) { + var angularSize = 2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14; + if (0 < x && angularSize > MIN_ANGULAR_SIZE) { + if (angularSize < MAX_ANGULAR_SIZE) { modelSelected = true; selectedModelID = foundModel; selectedModelProperties = properties; From 676141024a8a63a33664b3cd461709eaf44af17d Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 19 Jun 2014 10:46:06 -0700 Subject: [PATCH 2/5] Added angular size limit to hydras too. --- examples/editModels.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/editModels.js b/examples/editModels.js index d2670f59bf..8a73c79532 100644 --- a/examples/editModels.js +++ b/examples/editModels.js @@ -278,8 +278,9 @@ function controller(wichSide) { var X = Vec3.sum(A, Vec3.multiply(B, x)); var d = Vec3.length(Vec3.subtract(P, X)); - if (0 < x && x < LASER_LENGTH_FACTOR) { - if (2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14 > MAX_ANGULAR_SIZE) { + var angularSize = 2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14; + if (0 < x && angularSize > MIN_ANGULAR_SIZE) { + if (angularSize > MAX_ANGULAR_SIZE) { print("Angular size too big: " + 2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14); return { valid: false }; } From 4a4efb0bfaae0137a5af37905f6fa6288d577503 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 19 Jun 2014 11:11:08 -0700 Subject: [PATCH 3/5] Don't glow models if you can't grab it --- examples/editModels.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/editModels.js b/examples/editModels.js index 8a73c79532..55e4d56a21 100644 --- a/examples/editModels.js +++ b/examples/editModels.js @@ -328,7 +328,8 @@ function controller(wichSide) { origin: this.palmPosition, direction: this.front }); - if (intersection.accurate && intersection.modelID.isKnownID) { + var angularSize = 2 * Math.atan(intersection.modelProperties.radius / Vec3.distance(Camera.getPosition(), intersection.modelProperties.position)) * 180 / 3.14; + if (intersection.accurate && intersection.modelID.isKnownID && angularSize > MIN_ANGULAR_SIZE && angularSize < MAX_ANGULAR_SIZE) { this.glowedIntersectingModel = intersection.modelID; Models.editModel(this.glowedIntersectingModel, { glowLevel: 0.25 }); } @@ -887,7 +888,8 @@ function mouseMoveEvent(event) { glowedModelID.isKnownID = false; } - if (modelIntersection.modelID.isKnownID) { + var angularSize = 2 * Math.atan(modelIntersection.modelProperties.radius / Vec3.distance(Camera.getPosition(), modelIntersection.modelProperties.position)) * 180 / 3.14; + if (modelIntersection.modelID.isKnownID && angularSize > MIN_ANGULAR_SIZE && angularSize < MAX_ANGULAR_SIZE) { Models.editModel(modelIntersection.modelID, { glowLevel: 0.25 }); glowedModelID = modelIntersection.modelID; } From 266dc6be3ed229b7298d3b598dc850b91fd5c622 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 19 Jun 2014 18:09:17 -0700 Subject: [PATCH 4/5] fixed tooltip not disapearing when deleting model --- examples/editModels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/editModels.js b/examples/editModels.js index 55e4d56a21..f2b76a28c3 100644 --- a/examples/editModels.js +++ b/examples/editModels.js @@ -1119,8 +1119,8 @@ function handeMenuEvent(menuItem){ Models.editModel(editModelID, properties); } } - tooltip.show(false); } + tooltip.show(false); } Menu.menuItemEvent.connect(handeMenuEvent); From 4561a6e3269693b5654f559fca7ada62b4698e10 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 19 Jun 2014 18:10:06 -0700 Subject: [PATCH 5/5] Fixed voxel being deleted even though voxel tool is not selected --- examples/editVoxels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/editVoxels.js b/examples/editVoxels.js index cff0d65743..412612fdad 100644 --- a/examples/editVoxels.js +++ b/examples/editVoxels.js @@ -1196,7 +1196,7 @@ function menuItemEvent(menuItem) { print("deleting..."); if (isImporting) { cancelImport(); - } else { + } else if (voxelToolSelected) { Clipboard.deleteVoxel(selectedVoxel.x, selectedVoxel.y, selectedVoxel.z, selectedVoxel.s); } }