From 6edd109dfe3c6ffa6472388e6a307d92512df6c0 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 26 Jul 2018 15:23:54 -0700 Subject: [PATCH] revert back to the old way we checkForChildTooFarAway --- .../controllerModules/nearParentGrabEntity.js | 4 ++-- .../libraries/controllerDispatcherUtils.js | 19 ------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index 38334f5523..81d2116eff 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -22,7 +22,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); // XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true; // XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC; - + Script.include("/~/system/libraries/controllers"); function NearParentingGrabEntity(hand) { this.hand = hand; this.targetEntityID = null; @@ -174,7 +174,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); this.lastUnequipCheckTime = now; if (props.parentID === MyAvatar.SELF_ID) { var tearAwayDistance = TEAR_AWAY_DISTANCE * MyAvatar.sensorToWorldScale; - var distance = distanceBetweenEntityLocalPositionAndBoundingBox(props); + var distance = distanceBetweenPointAndEntityBoundingBox(props); if (distance > tearAwayDistance) { this.autoUnequipCounter++; } else { diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index e817bb4ee1..717ec2aa80 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -416,25 +416,6 @@ findHandChildEntities = function(hand) { }); }; -distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps) { - var localPoint = entityProps.localPosition; - var entityXform = new Xform(entityProps.rotation, entityProps.position); - var minOffset = Vec3.multiplyVbyV(entityProps.registrationPoint, entityProps.dimensions); - var maxOffset = Vec3.multiplyVbyV(Vec3.subtract(ONE_VEC, entityProps.registrationPoint), entityProps.dimensions); - var localMin = Vec3.subtract(entityXform.trans, minOffset); - var localMax = Vec3.sum(entityXform.trans, maxOffset); - - var v = {x: localPoint.x, y: localPoint.y, z: localPoint.z}; - v.x = Math.max(v.x, localMin.x); - v.x = Math.min(v.x, localMax.x); - v.y = Math.max(v.y, localMin.y); - v.y = Math.min(v.y, localMax.y); - v.z = Math.max(v.z, localMin.z); - v.z = Math.min(v.z, localMax.z); - - return Vec3.distance(v, localPoint); -}; - distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) { var entityXform = new Xform(entityProps.rotation, entityProps.position); var localPoint = entityXform.inv().xformPoint(point);