From 3e7364608bbc7e27283d93767e996d515b975832 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Thu, 22 Oct 2015 09:17:29 -0700 Subject: [PATCH 1/2] make handControllerGrab.js work with new API --- examples/controllers/handControllerGrab.js | 22 ++++++++++--------- interface/resources/controllers/standard.json | 13 ++--------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index 80fb4c8e40..17d16d1718 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -245,7 +245,7 @@ function MyController(hand, triggerAction) { }; this.updateSmoothedTrigger = function() { - var triggerValue = Controller.getActionValue(this.triggerAction); + var triggerValue = Controller.getValue(this.triggerAction); // smooth out trigger value this.triggerValue = (this.triggerValue * TRIGGER_SMOOTH_RATIO) + (triggerValue * (1.0 - TRIGGER_SMOOTH_RATIO)); @@ -260,7 +260,7 @@ function MyController(hand, triggerAction) { }; this.triggerSqueezed = function() { - var triggerValue = Controller.getActionValue(this.triggerAction); + var triggerValue = Controller.getValue(this.triggerAction); return triggerValue > TRIGGER_ON_VALUE; }; @@ -402,8 +402,9 @@ function MyController(hand, triggerAction) { this.distanceHolding = function() { - var handControllerPosition = Controller.getSpatialControlPosition(this.palm); - var handRotation = Quat.multiply(MyAvatar.orientation, Controller.getSpatialControlRawRotation(this.palm)); + var handControllerPosition = (this.hand === RIGHT_HAND) ? MyAvatar.rightHandPosition : MyAvatar.leftHandPosition; + var controllerHandInput = (this.hand === RIGHT_HAND) ? Controller.Standard.RightHand : Controller.Standard.LeftHand; + var handRotation = Quat.multiply(MyAvatar.orientation, Controller.getPoseValue(controllerHandInput).rotation); var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation", "gravity", "ignoreForCollisions"]); var now = Date.now(); @@ -452,8 +453,9 @@ function MyController(hand, triggerAction) { } var handPosition = this.getHandPosition(); - var handControllerPosition = Controller.getSpatialControlPosition(this.palm); - var handRotation = Quat.multiply(MyAvatar.orientation, Controller.getSpatialControlRawRotation(this.palm)); + var handControllerPosition = (this.hand === RIGHT_HAND) ? MyAvatar.rightHandPosition : MyAvatar.leftHandPosition; + var controllerHandInput = (this.hand === RIGHT_HAND) ? Controller.Standard.RightHand : Controller.Standard.LeftHand; + var handRotation = Quat.multiply(MyAvatar.orientation, Controller.getPoseValue(controllerHandInput).rotation); var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation"]); this.lineOn(handPosition, Vec3.subtract(grabbedProperties.position, handPosition), INTERSECT_COLOR); @@ -595,7 +597,7 @@ function MyController(hand, triggerAction) { } - this.currentHandControllerTipPosition = Controller.getSpatialControlPosition(this.tip); + this.currentHandControllerTipPosition = (this.hand === RIGHT_HAND) ? MyAvatar.rightHandTipPosition : MyAvatar.leftHandTipPosition;; this.currentObjectTime = Date.now(); }; @@ -613,7 +615,7 @@ function MyController(hand, triggerAction) { // of it's actual offset, let's try imparting a velocity which is at a fixed radius // from the palm. - var handControllerPosition = Controller.getSpatialControlPosition(this.tip); + var handControllerPosition = (this.hand === RIGHT_HAND) ? MyAvatar.rightHandPosition : MyAvatar.leftHandPosition; var now = Date.now(); var deltaPosition = Vec3.subtract(handControllerPosition, this.currentHandControllerTipPosition); // meters @@ -856,8 +858,8 @@ function MyController(hand, triggerAction) { }; } -var rightController = new MyController(RIGHT_HAND, Controller.findAction("RIGHT_HAND_CLICK")); -var leftController = new MyController(LEFT_HAND, Controller.findAction("LEFT_HAND_CLICK")); +var rightController = new MyController(RIGHT_HAND, Controller.Standard.RT); +var leftController = new MyController(LEFT_HAND, Controller.Standard.LT); function update() { rightController.update(); diff --git a/interface/resources/controllers/standard.json b/interface/resources/controllers/standard.json index ef6668ec07..2067d98380 100644 --- a/interface/resources/controllers/standard.json +++ b/interface/resources/controllers/standard.json @@ -12,17 +12,8 @@ { "from": [ "Standard.A", "Standard.B", "Standard.X", "Standard.Y" ], "to": "Standard.RightPrimaryThumb" }, { "from": "Standard.Start", "to": "Standard.RightSecondaryThumb" }, - { - "from": "Standard.RT", - "to": "Actions.BOOM_IN", - "filters": [ { "type": "scale", "scale": 0.1 } ] - }, - - { - "from": "Standard.LT", - "to": "Actions.BOOM_OUT", - "filters": [ { "type": "scale", "scale": 0.1 } ] - }, + { "from": "Standard.LT", "to": "Actions.LEFT_HAND_CLICK" }, + { "from": "Standard.RT", "to": "Actions.RIGHT_HAND_CLICK" }, { "from": "Standard.LeftHand", "to": "Actions.LEFT_HAND" }, { "from": "Standard.RightHand", "to": "Actions.RIGHT_HAND" } From 67f2a0c6c803263171a98ab02588079beb1a4ba8 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Thu, 22 Oct 2015 11:39:51 -0700 Subject: [PATCH 2/2] CR feedback on mappings --- interface/resources/controllers/standard.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/resources/controllers/standard.json b/interface/resources/controllers/standard.json index 2067d98380..5d6e8ce32f 100644 --- a/interface/resources/controllers/standard.json +++ b/interface/resources/controllers/standard.json @@ -12,10 +12,10 @@ { "from": [ "Standard.A", "Standard.B", "Standard.X", "Standard.Y" ], "to": "Standard.RightPrimaryThumb" }, { "from": "Standard.Start", "to": "Standard.RightSecondaryThumb" }, - { "from": "Standard.LT", "to": "Actions.LEFT_HAND_CLICK" }, - { "from": "Standard.RT", "to": "Actions.RIGHT_HAND_CLICK" }, + { "from": "Standard.LT", "to": "Actions.LeftHandClick" }, + { "from": "Standard.RT", "to": "Actions.RightHandClick" }, - { "from": "Standard.LeftHand", "to": "Actions.LEFT_HAND" }, - { "from": "Standard.RightHand", "to": "Actions.RIGHT_HAND" } + { "from": "Standard.LeftHand", "to": "Actions.LeftHand" }, + { "from": "Standard.RightHand", "to": "Actions.RightHand" } ] }