From 4a4efb0bfaae0137a5af37905f6fa6288d577503 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 19 Jun 2014 11:11:08 -0700 Subject: [PATCH] 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; }