diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index 580132a648..a9f3fbd668 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -172,8 +172,12 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); if (now - this.lastUnequipCheckTime > MSECS_PER_SEC * TEAR_AWAY_CHECK_TIME) { this.lastUnequipCheckTime = now; if (props.parentID === MyAvatar.SELF_ID) { - var sensorScaleFactor = MyAvatar.sensorToWorldScale; - if ((props.localPosition > TEAR_AWAY_DISTANCE * sensorScaleFactor)) { + var tearAwayDistance = TEAR_AWAY_DISTANCE; + var localX = props.localPosition.x; + var localZ = props.localPosition.z; + var localY = props.localPosition.y; + if ((localX > tearAwayDistance) || (localY > tearAwayDistance) || + (localZ > tearAwayDistance)) { this.autoUnequipCounter++; } else { this.autoUnequipCounter = 0; @@ -237,10 +241,8 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); for (var i = 0; i < nearbyEntityProperties.length; i++) { var props = nearbyEntityProperties[i]; var handPosition = controllerData.controllerLocations[this.hand].position; - var dist = distanceBetweenPointAndEntityBoundingBox(handPosition, props); var distance = Vec3.distance(handPosition, props.position); - if ((dist > TEAR_AWAY_DISTANCE) || - (distance > NEAR_GRAB_RADIUS * sensorScaleFactor)) { + if ((distance > NEAR_GRAB_RADIUS * sensorScaleFactor)) { continue; } if (entityIsGrabbable(props) || entityIsCloneable(props)) {