From ca5525cc3f6dd40866555cd25b1f928c1362b947 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 12 Feb 2016 06:58:14 -0800 Subject: [PATCH] if an entity already was near-picked, don't do a distance-to-center check on it. --- examples/controllers/handControllerGrab.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index e2f88ccb3b..908337f643 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -855,6 +855,7 @@ function MyController(hand) { getEntityCustomData(GRABBABLE_DATA_KEY, candidateEntities[i], DEFAULT_GRABBABLE_DATA); var grabDataForCandidate = getEntityCustomData(GRAB_USER_DATA_KEY, candidateEntities[i], {}); var propsForCandidate = Entities.getEntityProperties(candidateEntities[i], GRABBABLE_PROPERTIES); + var near = (nearPickedCandidateEntities.indexOf(candidateEntities[i]) >= 0); var isPhysical = this.propsArePhysical(propsForCandidate); var grabbable; @@ -916,7 +917,7 @@ function MyController(hand) { continue; } - if (this.state == STATE_SEARCHING && !isPhysical && distance > NEAR_PICK_MAX_DISTANCE) { + if (this.state == STATE_SEARCHING && !isPhysical && distance > NEAR_PICK_MAX_DISTANCE && !near) { // we can't distance-grab non-physical if (WANT_DEBUG_SEARCH_NAME && propsForCandidate.name == WANT_DEBUG_SEARCH_NAME) { print("grab is skipping '" + WANT_DEBUG_SEARCH_NAME + "': not physical and too far for near-grab");