From f3b65d06ada804155ff4d6b992189eed68bb86f6 Mon Sep 17 00:00:00 2001 From: r3tk0n Date: Tue, 26 Feb 2019 12:46:46 -0800 Subject: [PATCH] Fix frame of reference for rotations. --- .../system/controllers/controllerModules/farGrabEntity.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/system/controllers/controllerModules/farGrabEntity.js b/scripts/system/controllers/controllerModules/farGrabEntity.js index ee0fe5f106..2166495567 100644 --- a/scripts/system/controllers/controllerModules/farGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farGrabEntity.js @@ -242,15 +242,13 @@ Script.include("/~/system/libraries/controllers.js"); var pose = Controller.getPoseValue((this.getDominantHand() ? Controller.Standard.RightHand : Controller.Standard.LeftHand)); if (pose.valid) { if (!this.manipulating) { - //this.initialEntityRotation = Quat.multiply(this.getTargetRotation(), Quat.inverse(MyAvatar.orientation)); // Avatar frame. this.initialEntityRotation = this.getTargetRotation(); // Worldframe. - this.initialControllerRotation = Quat.multiply(MyAvatar.orientation, pose.rotation); // Worldframe. - //this.initialEntityRotation = Quat.multiply(this.getTargetRotation(), Quat.inverse(MyAvatar.orientation)); + this.initialControllerRotation = Quat.multiply(pose.rotation, MyAvatar.orientation); // Worldframe. this.manipulating = true; } } - var rot = Quat.multiply(MyAvatar.orientation, pose.rotation); + var rot = Quat.multiply(pose.rotation, MyAvatar.orientation); var rotBetween = this.calculateEntityRotationManipulation(rot); this.setJointRotation(Quat.multiply(rotBetween, this.initialEntityRotation)); } else {