From 580c2548e9fcf89327150138ba2848cb6e1f1e82 Mon Sep 17 00:00:00 2001 From: NeetBhagat Date: Fri, 2 Jun 2017 23:04:58 +0530 Subject: [PATCH] Initial Commit : 1) Resolve a bug when 2 different entity is grabbed in 2 hands. And move your left hand and entity of left hand grow/shrink when you move right/left hand. 2) Resolve right hand-left hand grow-shrink functionality --- scripts/system/controllers/handControllerGrab.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 993cf22d83..ba30b88113 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -3330,11 +3330,17 @@ function MyController(hand) { return; } + var isSameEntityInBothControllers = false; + if (leftController.grabbedThingID && rightController.grabbedThingID && + leftController.grabbedThingID == rightController.grabbedThingID) { + isSameEntityInBothControllers = true; + } + if (!this.shouldScale) { // If both secondary triggers squeezed, and the non-holding hand is empty, start scaling if (this.secondarySqueezed() && this.getOtherHandController().secondarySqueezed() && - this.getOtherHandController().state === STATE_OFF) { + isSameEntityInBothControllers) { this.scalingStartDistance = Vec3.length(Vec3.subtract(this.getHandPosition(), this.getOtherHandController().getHandPosition())); this.scalingStartDimensions = props.dimensions;