From 3a2b0ffa08966805d852947cc6b8fbc596ffa6aa Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Wed, 3 Aug 2016 00:47:28 +0200 Subject: [PATCH] Fixes the handControllerGrab `Hifi-Hand-Grab` message. Was broken since the hotspot changes to handControllerGrab.js. --- scripts/system/controllers/handControllerGrab.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index c023278a3b..cca1c0838a 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1267,7 +1267,7 @@ function MyController(hand) { if (this.triggerSmoothedGrab()) { this.grabbedHotspot = potentialEquipHotspot; this.grabbedEntity = potentialEquipHotspot.entityID; - this.setState(STATE_HOLD, "eqipping '" + entityPropertiesCache.getProps(this.grabbedEntity).name + "'"); + this.setState(STATE_HOLD, "equipping '" + entityPropertiesCache.getProps(this.grabbedEntity).name + "'"); return; } } @@ -2354,9 +2354,20 @@ var handleHandMessages = function(channel, message, sender) { try { data = JSON.parse(message); var selectedController = (data.hand === 'left') ? leftController : rightController; + var hotspotIndex = data.hotspotIndex !== undefined ? parseInt(data.hotspotIndex) : 0; selectedController.release(); + var wearableEntity = data.entityID; + entityPropertiesCache.addEntity(wearableEntity); + selectedController.grabbedEntity = wearableEntity; + var hotspots = selectedController.collectEquipHotspots(selectedController.grabbedEntity); + if (hotspots.length > 0) { + if (hotspotIndex >= hotspots.length) { + hotspotIndex = 0; + } + selectedController.grabbedHotspot = hotspots[hotspotIndex]; + } selectedController.setState(STATE_HOLD, "Hifi-Hand-Grab msg received"); - selectedController.grabbedEntity = data.entityID; + selectedController.nearGrabbingEnter(); } catch (e) { print("WARNING: error parsing Hifi-Hand-Grab message");