From 8dddf0e17a3de794c8a36d94fbb0ceb69d189196 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Mon, 12 Oct 2015 11:15:04 -0700 Subject: [PATCH] Added findRayIntersection, and confirmed judder grew a lot worse --- .../whiteboard/whiteboardEntityScript.js | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index c8e914b0e0..f9f272d5a3 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -18,6 +18,8 @@ var _this; var RIGHT_HAND = 1; var LEFT_HAND = 0; + var SPATIAL_CONTROLLERS_PER_PALM = 2; + var TIP_CONTROLLER_OFFSET = 1; Whiteboard = function() { _this = this; }; @@ -33,11 +35,33 @@ }, startFarGrabNonColliding: function() { - this.activeHand = this.hand; + if (this.hand === RIGHT_HAND) { + this.getHandPosition = MyAvatar.getRightPalmPosition; + this.getHandRotation = MyAvatar.getRightPalmRotation; + this.triggerAction = Controller.findAction("RIGHT_HAND_CLICK"); + } else if (this.hand === LEFT_HAND) { + this.getHandPosition = MyAvatar.getLeftPalmPosition; + this.getHandRotation = MyAvatar.getLeftPalmRotation; + this.triggerAction = Controller.findAction("LEFT_HAND_CLICK"); + } }, continueFarGrabbingNonColliding: function() { - var handClick = Controller.findAction(handClickString); + var handPosition = this.getHandPosition(); + var pickRay = { + origin: handPosition, + direction: Quat.getUp(this.getHandRotation()) + }; + this.intersection = Entities.findRayIntersection(pickRay, true); + if (this.intersection.intersects) { + if(JSON.stringify(this.intersection.entityID) === JSON.stringify(this.entityID)) { + print('YAAAAA') + } + } + }, + + releaseGrab: function() { + }, preload: function(entityID) {