From 2dc38441168ee0ff1b953d0425b657b6e4f60699 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 19 Jul 2017 17:07:57 -0700 Subject: [PATCH] Improve reliability of hand lasers; increase size of target --- .../src/ui/overlays/ContextOverlayInterface.cpp | 2 +- .../system/controllers/handControllerGrab.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/interface/src/ui/overlays/ContextOverlayInterface.cpp b/interface/src/ui/overlays/ContextOverlayInterface.cpp index 3ab01ea8b1..c52ef1bb16 100644 --- a/interface/src/ui/overlays/ContextOverlayInterface.cpp +++ b/interface/src/ui/overlays/ContextOverlayInterface.cpp @@ -52,7 +52,7 @@ void ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID& _contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay); } - _contextOverlay->setDimensions(glm::vec2(0.05f, 0.05f) * glm::distance(entityProperties.getPosition(), qApp->getCamera().getPosition())); + _contextOverlay->setDimensions(glm::vec2(0.1f, 0.1f) * glm::distance(entityProperties.getPosition(), qApp->getCamera().getPosition())); _contextOverlay->setPosition(entityProperties.getPosition()); _contextOverlay->setRotation(entityProperties.getRotation()); _contextOverlay->setVisible(true); diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 5fd4df0e4d..9a1540cc78 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -187,6 +187,7 @@ var DEFAULT_GRABBABLE_DATA = { var USE_BLACKLIST = true; var blacklist = []; +var potentialEntityWithContextOverlay = false; var entityWithContextOverlay = false; var contextualHand = -1; @@ -2221,13 +2222,13 @@ function MyController(hand) { entityPropertiesCache.addEntity(rayPickInfo.entityID); } - if (rayPickInfo.entityID && (entityWithContextOverlay !== rayPickInfo.entityID)) { - if (entityWithContextOverlay) { - ContextOverlay.destroyContextOverlay(entityWithContextOverlay); - entityWithContextOverlay = false; - } + if (rayPickInfo.entityID && !entityWithContextOverlay) { Script.setTimeout(function () { - if (rayPickInfo.entityID === entityWithContextOverlay && contextualHand !== -1) { + if (rayPickInfo.entityID === potentialEntityWithContextOverlay && + !entityWithContextOverlay + && contextualHand !== -1) { + entityWithContextOverlay = rayPickInfo.entityID; + potentialEntityWithContextOverlay = false; var pointerEvent = { type: "Move", id: contextualHand + 1, // 0 is reserved for hardware mouse @@ -2240,8 +2241,8 @@ function MyController(hand) { ContextOverlay.createOrDestroyContextOverlay(rayPickInfo.entityID, pointerEvent); } }, 500); - entityWithContextOverlay = rayPickInfo.entityID; contextualHand = this.hand; + potentialEntityWithContextOverlay = rayPickInfo.entityID; } var candidateHotSpotEntities = Entities.findEntities(handPosition, MAX_EQUIP_HOTSPOT_RADIUS); @@ -3492,6 +3493,7 @@ function MyController(hand) { if (entityWithContextOverlay) { ContextOverlay.destroyContextOverlay(entityWithContextOverlay); entityWithContextOverlay = false; + potentialEntityWithContextOverlay = false; } if (isInEditMode()) { @@ -3631,6 +3633,7 @@ function MyController(hand) { Overlays.sendMousePressOnOverlay(this.grabbedOverlay, pointerEvent); entityWithContextOverlay = false; + potentialEntityWithContextOverlay = false; this.touchingEnterTimer = 0; this.touchingEnterPointerEvent = pointerEvent;