From 38096b48d97d0e73fd2b62e157c94fda15771350 Mon Sep 17 00:00:00 2001 From: druiz17 Date: Wed, 27 Sep 2017 10:52:56 -0700 Subject: [PATCH 1/3] fixing entitySelectionTool --- scripts/system/edit.js | 1 + .../system/libraries/entitySelectionTool.js | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 467fa95dd7..5d29d8103b 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -1245,6 +1245,7 @@ var lastPosition = null; Script.update.connect(function (deltaTime) { progressDialog.move(); selectionDisplay.checkMove(); + selectionDisplay.checkControllerMove(); var dOrientation = Math.abs(Quat.dot(Camera.orientation, lastOrientation) - 1); var dPosition = Vec3.distance(Camera.position, lastPosition); if (dOrientation > 0.001 || dPosition > 0.001) { diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 44f3c9e041..9c84660949 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -276,6 +276,10 @@ SelectionDisplay = (function() { var overlayNames = []; var lastCameraPosition = Camera.getPosition(); var lastCameraOrientation = Camera.getOrientation(); + var lastControllerPoses = [ + getControllerWorldLocation(Controller.Standard.LeftHand, true), + getControllerWorldLocation(Controller.Standard.RightHand, true) + ]; var handleHoverColor = { red: 224, @@ -4065,6 +4069,22 @@ SelectionDisplay = (function() { } }; + that.checkControllerMove = function() { + if (SelectionManager.hasSelection()) { + var controllerPose = getControllerWorldLocation(activeHand, true); + var hand = (activeHand === Controller.Standard.LeftHand) ? 0 : 1; + print(hand); + if (controllerPose.valid && lastControllerPoses[hand].valid) { + if (!Vec3.equal(controllerPose.position, lastControllerPoses[hand].position) || + !Vec3.equal(controllerPose.rotation, lastControllerPoses[hand].rotation)) { + print("setting controller pose"); + that.mouseMoveEvent({}); + } + } + lastControllerPoses[hand] = controllerPose; + } + }; + // FUNCTION: MOUSE PRESS EVENT that.mousePressEvent = function(event) { var wantDebug = false; From cea3c002dd57167d726171ddd93ee370c677c686 Mon Sep 17 00:00:00 2001 From: druiz17 Date: Wed, 27 Sep 2017 11:47:26 -0700 Subject: [PATCH 2/3] improving far rotate --- .../controllers/controllerModules/farActionGrabEntity.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index 03e2c0baee..5c31c859e9 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -369,11 +369,6 @@ Script.include("/~/system/libraries/controllers.js"); otherFarGrabModule.currentObjectRotation = Quat.multiply(controllerRotationDelta, otherFarGrabModule.currentObjectRotation); - // Rotate about the translation controller's target position. - this.offsetPosition = Vec3.multiplyQbyV(controllerRotationDelta, this.offsetPosition); - otherFarGrabModule.offsetPosition = Vec3.multiplyQbyV(controllerRotationDelta, - otherFarGrabModule.offsetPosition); - this.previousWorldControllerRotation = worldControllerRotation; }; @@ -495,6 +490,7 @@ Script.include("/~/system/libraries/controllers.js"); } if (otherFarGrabModule.grabbedThingID === this.grabbedThingID && otherFarGrabModule.distanceHolding) { + this.prepareDistanceRotatingData(controllerData); this.distanceRotate(otherFarGrabModule); } else { this.distanceHolding = true; From 58a00a89d788321115acf197f3c60460be189080 Mon Sep 17 00:00:00 2001 From: druiz17 Date: Wed, 27 Sep 2017 12:58:11 -0700 Subject: [PATCH 3/3] remove debug print --- scripts/system/libraries/entitySelectionTool.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 9c84660949..4df25c41b7 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -4073,7 +4073,6 @@ SelectionDisplay = (function() { if (SelectionManager.hasSelection()) { var controllerPose = getControllerWorldLocation(activeHand, true); var hand = (activeHand === Controller.Standard.LeftHand) ? 0 : 1; - print(hand); if (controllerPose.valid && lastControllerPoses[hand].valid) { if (!Vec3.equal(controllerPose.position, lastControllerPoses[hand].position) || !Vec3.equal(controllerPose.rotation, lastControllerPoses[hand].rotation)) {