diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index e1b432d09f..d1c00a9d81 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1094,7 +1094,6 @@ function MyController(hand) { this.grabbedOverlay = null; this.state = STATE_OFF; this.pointer = null; // entity-id of line object - this.entityActivated = false; this.triggerValue = 0; // rolling average of trigger value this.triggerClicked = false; @@ -2826,12 +2825,6 @@ function MyController(hand) { Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand); - if (this.entityActivated) { - var saveGrabbedID = this.grabbedThingID; - this.release(); - this.grabbedThingID = saveGrabbedID; - } - var grabbedProperties; if (this.grabbedIsOverlay) { grabbedProperties = { @@ -3007,22 +3000,25 @@ function MyController(hand) { * is called correctly, as these just freshly created entity may not have completely initialized. */ var grabEquipCheck = function () { - if (_this.state == STATE_NEAR_GRABBING) { - _this.callEntityMethodOnGrabbed("startNearGrab"); + if (_this.state == STATE_NEAR_GRABBING) { + _this.callEntityMethodOnGrabbed("startNearGrab"); } else { // this.state == STATE_HOLD - _this.callEntityMethodOnGrabbed("startEquip"); + _this.callEntityMethodOnGrabbed("startEquip"); } - _this.currentHandControllerTipPosition = - (_this.hand === RIGHT_HAND) ? MyAvatar.rightHandTipPosition : MyAvatar.leftHandTipPosition; - _this.currentObjectTime = Date.now(); + // don't block teleport raypick with equipped entity + Messages.sendMessage('Hifi-Teleport-Ignore-Add', _this.grabbedThingID); - _this.currentObjectPosition = grabbedProperties.position; - _this.currentObjectRotation = grabbedProperties.rotation; - _this.currentVelocity = ZERO_VEC; - _this.currentAngularVelocity = ZERO_VEC; + _this.currentHandControllerTipPosition = + (_this.hand === RIGHT_HAND) ? MyAvatar.rightHandTipPosition : MyAvatar.leftHandTipPosition; + _this.currentObjectTime = Date.now(); - _this.prevDropDetected = false; + _this.currentObjectPosition = grabbedProperties.position; + _this.currentObjectRotation = grabbedProperties.rotation; + _this.currentVelocity = ZERO_VEC; + _this.currentAngularVelocity = ZERO_VEC; + + _this.prevDropDetected = false; } if (isClone) { @@ -3654,6 +3650,9 @@ function MyController(hand) { this.turnOffVisualizations(); if (this.grabbedThingID !== null) { + + Messages.sendMessage('Hifi-Teleport-Ignore-Remove', this.grabbedThingID); + if (this.state === STATE_HOLD) { this.callEntityMethodOnGrabbed("releaseEquip"); }