From 8b6e89a5c464aa78d9eb4761e38b6d47ac5ba314 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 18 Jan 2016 11:13:33 -0800 Subject: [PATCH] fix stopFarTrigger entity method call. re-add code to keep more than one distance grab per object from happening --- examples/controllers/handControllerGrab.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index 7721366bab..3b46a51960 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -42,7 +42,7 @@ var PICK_WITH_HAND_RAY = true; var DISTANCE_HOLDING_RADIUS_FACTOR = 3.5; // multiplied by distance between hand and object var DISTANCE_HOLDING_ACTION_TIMEFRAME = 0.1; // how quickly objects move to their new position var DISTANCE_HOLDING_ROTATION_EXAGGERATION_FACTOR = 2.0; // object rotates this much more than hand did -var MOVE_WITH_HEAD = true; // experimental head-controll of distantly held objects +var MOVE_WITH_HEAD = true; // experimental head-control of distantly held objects var FAR_TO_NEAR_GRAB_PADDING_FACTOR = 1.2; var NO_INTERSECT_COLOR = { @@ -917,6 +917,10 @@ function MyController(hand) { } // far grab or equip with action if (isPhysical && !near) { + if (entityIsGrabbedByOther(intersection.entityID)) { + // don't distance grab something that is already grabbed. + return; + } this.temporaryPositionOffset = null; if (typeof grabbableData.spatialKey === 'undefined') { // We want to give a temporary position offset to this object so it is pulled close to hand @@ -1143,7 +1147,6 @@ function MyController(hand) { y: this.currentObjectPosition.y, z: this.currentObjectPosition.z } - } @@ -1489,7 +1492,7 @@ function MyController(hand) { this.continueFarTrigger = function() { if (this.triggerSmoothedReleased()) { this.setState(STATE_RELEASE); - Entities.callEntityMethod(this.grabbedEntity, "stopNearTrigger"); + Entities.callEntityMethod(this.grabbedEntity, "stopFarTrigger"); return; }