From 64f849568168faaa6c82b8f2782c8b2465b6f982 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 26 Jan 2015 18:20:08 -0800 Subject: [PATCH] Fixed mapped rotation + doubled it --- examples/controllers/hydra/hydraGrab.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/controllers/hydra/hydraGrab.js b/examples/controllers/hydra/hydraGrab.js index 5da296f117..202a226f1e 100644 --- a/examples/controllers/hydra/hydraGrab.js +++ b/examples/controllers/hydra/hydraGrab.js @@ -108,7 +108,7 @@ function controller(wichSide) { this.positionAtGrab; this.rotationAtGrab; this.modelPositionAtGrab; - this.rotationAtGrab; + this.modelRotationAtGrab; this.jointsIntersectingFromStart = []; this.laser = Overlays.addOverlay("line3d", { @@ -165,7 +165,7 @@ function controller(wichSide) { this.positionAtGrab = this.palmPosition; this.rotationAtGrab = this.rotation; this.modelPositionAtGrab = properties.position; - this.rotationAtGrab = properties.rotation; + this.modelRotationAtGrab = properties.rotation; this.jointsIntersectingFromStart = []; for (var i = 0; i < jointList.length; i++) { var distance = Vec3.distance(MyAvatar.getJointPosition(jointList[i]), this.oldModelPosition); @@ -381,8 +381,9 @@ function controller(wichSide) { newRotation = Quat.multiply(this.rotation, Quat.inverse(this.rotationAtGrab)); + newRotation = Quat.multiply(newRotation, newRotation); newRotation = Quat.multiply(newRotation, - this.rotationAtGrab); + this.modelRotationAtGrab); break; } Entities.editEntity(this.entityID, { @@ -595,11 +596,11 @@ function moveEntities() { leftController.positionAtGrab = leftController.palmPosition; leftController.rotationAtGrab = leftController.rotation; leftController.modelPositionAtGrab = leftController.oldModelPosition; - leftController.rotationAtGrab = rotation; + leftController.modelRotationAtGrab = rotation; rightController.positionAtGrab = rightController.palmPosition; rightController.rotationAtGrab = rightController.rotation; rightController.modelPositionAtGrab = rightController.oldModelPosition; - rightController.rotationAtGrab = rotation; + rightController.modelRotationAtGrab = rotation; break; } Entities.editEntity(leftController.entityID, {