From 00be6b3e3a12ee2de08360b484fd73fe3a2d8879 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 30 Oct 2015 17:32:26 -0700 Subject: [PATCH 01/12] Add support for NOT conditional in the route json --- .../src/controllers/UserInputMapper.cpp | 19 ++++++++++++++++++- .../impl/conditionals/EndpointConditional.h | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp index d33e215797..6462103290 100755 --- a/libraries/controllers/src/controllers/UserInputMapper.cpp +++ b/libraries/controllers/src/controllers/UserInputMapper.cpp @@ -825,12 +825,29 @@ Conditional::Pointer UserInputMapper::parseConditional(const QJsonValue& value) return std::make_shared(children); } else if (value.isString()) { // Support "when" : "GamePad.RB" - auto input = findDeviceInput(value.toString()); + auto conditionalToken = value.toString(); + + // Detect for modifier case (Not...) + QString conditionalModifier; + const QString JSON_CONDITIONAL_MODIFIER_NOT("!"); + if (conditionalToken.startsWith(JSON_CONDITIONAL_MODIFIER_NOT)) { + conditionalModifier = JSON_CONDITIONAL_MODIFIER_NOT; + conditionalToken = conditionalToken.right(conditionalToken.size() - conditionalModifier.size()); + } + + auto input = findDeviceInput(conditionalToken); auto endpoint = endpointFor(input); if (!endpoint) { return Conditional::Pointer(); } + if (!conditionalModifier.isEmpty()) { + if (conditionalModifier == JSON_CONDITIONAL_MODIFIER_NOT) { + return std::make_shared(endpoint); + } + } + + // Default and conditional behavior return std::make_shared(endpoint); } diff --git a/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.h b/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.h index 1e4205afc7..8f0499077e 100644 --- a/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.h +++ b/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.h @@ -23,5 +23,13 @@ private: Endpoint::Pointer _endpoint; }; +class NotEndpointConditional : public Conditional { +public: + NotEndpointConditional(Endpoint::Pointer endpoint) : _endpoint(endpoint) {} + virtual bool satisfied() override { return _endpoint && _endpoint->value() == 0.0; } +private: + Endpoint::Pointer _endpoint; +}; + } #endif From b067abe2d9f74a93afda0fe858b2a71adccf991c Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Mon, 2 Nov 2015 09:58:23 -0800 Subject: [PATCH 02/12] Added name to basketball hoop in reset scripts --- unpublishedScripts/hiddenEntityReset.js | 1 + unpublishedScripts/masterReset.js | 1 + 2 files changed, 2 insertions(+) diff --git a/unpublishedScripts/hiddenEntityReset.js b/unpublishedScripts/hiddenEntityReset.js index 43d23e4b3c..015157fd26 100644 --- a/unpublishedScripts/hiddenEntityReset.js +++ b/unpublishedScripts/hiddenEntityReset.js @@ -944,6 +944,7 @@ var hoop = Entities.addEntity({ type: "Model", modelURL: hoopURL, + name: "Basketball Hoop", position: position, rotation: rotation, shapeType: 'compound', diff --git a/unpublishedScripts/masterReset.js b/unpublishedScripts/masterReset.js index 74eb3c85ac..2e7a7ee2e7 100644 --- a/unpublishedScripts/masterReset.js +++ b/unpublishedScripts/masterReset.js @@ -921,6 +921,7 @@ MasterReset = function() { var hoop = Entities.addEntity({ type: "Model", + name: "Basketball Hoop", modelURL: hoopURL, position: position, rotation: rotation, From 3019886344f9f6101f10d682b7d81ac8d04a63ac Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Mon, 2 Nov 2015 11:08:06 -0800 Subject: [PATCH 03/12] Removing basketball hoop from reset scripts Hoop will be saved in SVO instead --- unpublishedScripts/hiddenEntityReset.js | 44 ------------------------- unpublishedScripts/masterReset.js | 43 +----------------------- 2 files changed, 1 insertion(+), 86 deletions(-) diff --git a/unpublishedScripts/hiddenEntityReset.js b/unpublishedScripts/hiddenEntityReset.js index 015157fd26..f56c705ce4 100644 --- a/unpublishedScripts/hiddenEntityReset.js +++ b/unpublishedScripts/hiddenEntityReset.js @@ -114,7 +114,6 @@ createTargets(); createTargetResetter(); - createBasketballHoop(); createBasketballRack(); createBasketballResetter(); @@ -130,14 +129,11 @@ z: 503.49 }); - createSprayCan({ x: 549.7, y: 495.6, z: 503.91 }); - - } function deleteAllToys() { @@ -930,46 +926,6 @@ }); } - function createBasketballHoop() { - var position = { - x: 539.23, - y: 496.13, - z: 475.89 - }; - var rotation = Quat.fromPitchYawRollDegrees(0, 58.49, 0); - - var hoopURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop.fbx"; - var hoopCollisionHullURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop_collision_hull.obj"; - - var hoop = Entities.addEntity({ - type: "Model", - modelURL: hoopURL, - name: "Basketball Hoop", - position: position, - rotation: rotation, - shapeType: 'compound', - gravity: { - x: 0, - y: -9.8, - z: 0 - }, - dimensions: { - x: 1.89, - y: 3.99, - z: 3.79 - }, - compoundShapeURL: hoopCollisionHullURL, - userData: JSON.stringify({ - resetMe: { - resetMe: true - }, - grabbableKey: { - grabbable: false - } - }) - }); - } - function createWand(position) { var WAND_MODEL = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/wand.fbx'; var WAND_COLLISION_SHAPE = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/actual_no_top_collision_hull.obj'; diff --git a/unpublishedScripts/masterReset.js b/unpublishedScripts/masterReset.js index 2e7a7ee2e7..b138db163d 100644 --- a/unpublishedScripts/masterReset.js +++ b/unpublishedScripts/masterReset.js @@ -10,7 +10,7 @@ //per script -/*global deleteAllToys, createAllToys, createGates, createPingPongBallGun, createFire, createPottedPlant, createCombinedArmChair, createBasketballHoop, createBasketBall, createSprayCan, createDoll, createWand, createDice, createCat, deleteAllToys, createFlashlight, createBlocks, createMagballs, createLights */ +/*global deleteAllToys, createAllToys, createGates, createPingPongBallGun, createFire, createPottedPlant, createCombinedArmChair, createBasketBall, createSprayCan, createDoll, createWand, createDice, createCat, deleteAllToys, createFlashlight, createBlocks, createMagballs, createLights */ var utilitiesScript = Script.resolvePath("../examples/libraries/utils.js"); Script.include(utilitiesScript); @@ -87,7 +87,6 @@ MasterReset = function() { createTargets(); createTargetResetter(); - createBasketballHoop(); createBasketballRack(); createBasketballResetter(); @@ -908,46 +907,6 @@ MasterReset = function() { }); } - function createBasketballHoop() { - var position = { - x: 539.23, - y: 496.13, - z: 475.89 - }; - var rotation = Quat.fromPitchYawRollDegrees(0, 58.49, 0); - - var hoopURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop.fbx"; - var hoopCollisionHullURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop_collision_hull.obj"; - - var hoop = Entities.addEntity({ - type: "Model", - name: "Basketball Hoop", - modelURL: hoopURL, - position: position, - rotation: rotation, - shapeType: 'compound', - gravity: { - x: 0, - y: -9.8, - z: 0 - }, - dimensions: { - x: 1.89, - y: 3.99, - z: 3.79 - }, - compoundShapeURL: hoopCollisionHullURL, - userData: JSON.stringify({ - resetMe: { - resetMe: true - }, - grabbableKey: { - grabbable: false - } - }) - }); - } - function createWand(position) { var WAND_MODEL = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/wand.fbx'; var WAND_COLLISION_SHAPE = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/actual_no_top_collision_hull.obj'; From 46bedf7667db02fc0bdf74fd43efc1ff68eabd66 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Mon, 2 Nov 2015 13:35:49 -0800 Subject: [PATCH 04/12] more tweaks to hydra mappings --- interface/resources/controllers/hydra.json | 14 ++++---------- interface/resources/controllers/standard.json | 6 +++--- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/interface/resources/controllers/hydra.json b/interface/resources/controllers/hydra.json index 20d954932a..0cdeba1b8d 100644 --- a/interface/resources/controllers/hydra.json +++ b/interface/resources/controllers/hydra.json @@ -13,17 +13,11 @@ { "from": "Hydra.RB", "to": "Standard.RB" }, { "from": "Hydra.RS", "to": "Standard.RS" }, - { "from": "Hydra.L0", "to": "Standard.Back" }, - { "from": "Hydra.L1", "to": "Standard.DL" }, - { "from": "Hydra.L2", "to": "Standard.DD" }, - { "from": "Hydra.L3", "to": "Standard.DR" }, - { "from": "Hydra.L4", "to": "Standard.DU" }, + { "from": "Hydra.L1", "to": "Standard.LeftPrimaryThumb" }, + { "from": "Hydra.L2", "to": "Standard.LeftSecondaryThumb" }, - { "from": "Hydra.R0", "to": "Standard.Start" }, - { "from": "Hydra.R1", "to": "Standard.X" }, - { "from": "Hydra.R2", "to": "Standard.A" }, - { "from": "Hydra.R3", "to": "Standard.B" }, - { "from": "Hydra.R4", "to": "Standard.Y" }, + { "from": "Hydra.R1", "to": "Standard.RightPrimaryThumb" }, + { "from": "Hydra.R2", "to": "Standard.RightSecondaryThumb" }, { "from": "Hydra.LeftHand", "to": "Standard.LeftHand" }, { "from": "Hydra.RightHand", "to": "Standard.RightHand" } diff --git a/interface/resources/controllers/standard.json b/interface/resources/controllers/standard.json index b08abcbaad..d312913a23 100644 --- a/interface/resources/controllers/standard.json +++ b/interface/resources/controllers/standard.json @@ -2,9 +2,8 @@ "name": "Standard to Action", "channels": [ { "from": "Standard.LY", "to": "Actions.TranslateZ" }, - { "from": "Standard.LX", "to": "Actions.TranslateX" }, - { "from": "Standard.RX", + { "from": "Standard.LX", "when": [ "Application.InHMD", "Application.ComfortMode" ], "to": "Actions.StepYaw", "filters": @@ -14,8 +13,9 @@ ] }, + { "from": "Standard.LX", "to": "Actions.Yaw" }, - { "from": "Standard.RX", "to": "Actions.Yaw" }, + { "from": "Standard.RX", "to": "Actions.TranslateX" }, { "from": "Standard.RY", "filters": "invert", "to": "Actions.TranslateY" }, From d359aa3b654a6235da3e651bdfb05b5383be2982 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Mon, 2 Nov 2015 13:41:16 -0800 Subject: [PATCH 05/12] more tweaks --- interface/resources/controllers/hydra.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/interface/resources/controllers/hydra.json b/interface/resources/controllers/hydra.json index 0cdeba1b8d..b517d1bad5 100644 --- a/interface/resources/controllers/hydra.json +++ b/interface/resources/controllers/hydra.json @@ -13,11 +13,12 @@ { "from": "Hydra.RB", "to": "Standard.RB" }, { "from": "Hydra.RS", "to": "Standard.RS" }, - { "from": "Hydra.L1", "to": "Standard.LeftPrimaryThumb" }, - { "from": "Hydra.L2", "to": "Standard.LeftSecondaryThumb" }, + { "from": [ "Hydra.L3", "Hydra.L4" ], "to": "Standard.LeftPrimaryThumb" }, + { "from": [ "Hydra.L1", "Hydra.L2" ], "to": "Standard.LeftSecondaryThumb" }, + + { "from": [ "Hydra.R3", "Hydra.R4" ], "to": "Standard.RightPrimaryThumb" }, + { "from": [ "Hydra.R1", "Hydra.R2" ], "to": "Standard.RightSecondaryThumb" }, - { "from": "Hydra.R1", "to": "Standard.RightPrimaryThumb" }, - { "from": "Hydra.R2", "to": "Standard.RightSecondaryThumb" }, { "from": "Hydra.LeftHand", "to": "Standard.LeftHand" }, { "from": "Hydra.RightHand", "to": "Standard.RightHand" } From c2687b4998ad47c4b15dd6ba951e30786ea5562f Mon Sep 17 00:00:00 2001 From: samcake Date: Mon, 2 Nov 2015 14:17:07 -0800 Subject: [PATCH 06/12] Cleaning the feature not conditional do the true design --- .../src/controllers/UserInputMapper.cpp | 9 ++++----- .../impl/conditionals/EndpointConditional.h | 8 -------- .../impl/conditionals/NotConditional.cpp | 20 ++++++++++++------- .../impl/conditionals/NotConditional.h | 14 +++++++++++++ 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp index 5edc3390a6..a5d447d479 100755 --- a/libraries/controllers/src/controllers/UserInputMapper.cpp +++ b/libraries/controllers/src/controllers/UserInputMapper.cpp @@ -26,6 +26,7 @@ #include "Logging.h" #include "impl/conditionals/AndConditional.h" +#include "impl/conditionals/NotConditional.h" #include "impl/conditionals/EndpointConditional.h" #include "impl/conditionals/ScriptConditional.h" @@ -838,18 +839,16 @@ Conditional::Pointer UserInputMapper::parseConditional(const QJsonValue& value) auto input = findDeviceInput(conditionalToken); auto endpoint = endpointFor(input); - if (!endpoint) { - return Conditional::Pointer(); - } + auto conditional = std::make_shared(endpoint); if (!conditionalModifier.isEmpty()) { if (conditionalModifier == JSON_CONDITIONAL_MODIFIER_NOT) { - return std::make_shared(endpoint); + return std::make_shared(conditional); } } // Default and conditional behavior - return std::make_shared(endpoint); + return conditional; } return Conditional::parse(value); diff --git a/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.h b/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.h index 36fd3e5daa..0ba1347087 100644 --- a/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.h +++ b/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.h @@ -23,13 +23,5 @@ private: Endpoint::Pointer _endpoint; }; -class NotEndpointConditional : public Conditional { -public: - NotEndpointConditional(Endpoint::Pointer endpoint) : _endpoint(endpoint) {} - virtual bool satisfied() override { return _endpoint && _endpoint->value() == 0.0; } -private: - Endpoint::Pointer _endpoint; -}; - } #endif diff --git a/libraries/controllers/src/controllers/impl/conditionals/NotConditional.cpp b/libraries/controllers/src/controllers/impl/conditionals/NotConditional.cpp index e30b060985..813c8ebfad 100644 --- a/libraries/controllers/src/controllers/impl/conditionals/NotConditional.cpp +++ b/libraries/controllers/src/controllers/impl/conditionals/NotConditional.cpp @@ -6,10 +6,16 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "NotConditional.h" + +#include "NotConditional.h" + +using namespace controller; + +bool NotConditional::satisfied() { + if (_operand) { + return (!_operand->satisfied()); + } else { + return false; + } +} + diff --git a/libraries/controllers/src/controllers/impl/conditionals/NotConditional.h b/libraries/controllers/src/controllers/impl/conditionals/NotConditional.h index 3acda07106..6b19cf9505 100644 --- a/libraries/controllers/src/controllers/impl/conditionals/NotConditional.h +++ b/libraries/controllers/src/controllers/impl/conditionals/NotConditional.h @@ -12,5 +12,19 @@ #include "../Conditional.h" +namespace controller { + + class NotConditional : public Conditional { + public: + using Pointer = std::shared_ptr; + + NotConditional(Conditional::Pointer operand) : _operand(operand) { } + + virtual bool satisfied() override; + + private: + Conditional::Pointer _operand; + }; +} #endif From 181901ed1930f11f25c2f3762ab43747501f838b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 2 Nov 2015 14:42:28 -0800 Subject: [PATCH 07/12] distance grab works better with hmd on --- examples/controllers/handControllerGrab.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index 9f7d579f10..b882777048 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -446,7 +446,7 @@ function MyController(hand) { this.currentObjectPosition = grabbedProperties.position; this.currentObjectRotation = grabbedProperties.rotation; this.currentObjectTime = now; - this.handPreviousPosition = handControllerPosition; + this.handRelativePreviousPosition = Vec3.subtract(handControllerPosition, MyAvatar.position); this.handPreviousRotation = handRotation; this.actionID = NULL_ACTION_ID; @@ -523,11 +523,10 @@ function MyController(hand) { this.currentAvatarOrientation = currentOrientation; // how far did hand move this timestep? - var handMoved = Vec3.subtract(handControllerPosition, this.handPreviousPosition); - this.handPreviousPosition = handControllerPosition; + var handMoved = Vec3.subtract(handToAvatar, this.handRelativePreviousPosition); + this.handRelativePreviousPosition = handToAvatar; // magnify the hand movement but not the change from avatar movement & rotation - handMoved = Vec3.subtract(handMoved, avatarDeltaPosition); handMoved = Vec3.subtract(handMoved, handMovementFromTurning); var superHandMoved = Vec3.multiply(handMoved, radius); From 0211e00c86bc49a91c5d5944f8c87df4d8014752 Mon Sep 17 00:00:00 2001 From: samcake Date: Mon, 2 Nov 2015 15:01:59 -0800 Subject: [PATCH 08/12] Cleaning the feature not conditional do the true design --- libraries/controllers/src/controllers/UserInputMapper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp index a5d447d479..192404b85a 100755 --- a/libraries/controllers/src/controllers/UserInputMapper.cpp +++ b/libraries/controllers/src/controllers/UserInputMapper.cpp @@ -839,6 +839,9 @@ Conditional::Pointer UserInputMapper::parseConditional(const QJsonValue& value) auto input = findDeviceInput(conditionalToken); auto endpoint = endpointFor(input); + if (!endpoint) { + return Conditional::Pointer(); + } auto conditional = std::make_shared(endpoint); if (!conditionalModifier.isEmpty()) { From f532607ccab1b94c150c6f207dbf49557c0148ad Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Mon, 2 Nov 2015 15:06:38 -0800 Subject: [PATCH 09/12] add touch and other gestures to standard --- .../src/controllers/StandardController.cpp | 22 +++++++++++++++++-- .../src/controllers/StandardControls.h | 17 ++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/libraries/controllers/src/controllers/StandardController.cpp b/libraries/controllers/src/controllers/StandardController.cpp index 31c023b1ea..5b68f38374 100644 --- a/libraries/controllers/src/controllers/StandardController.cpp +++ b/libraries/controllers/src/controllers/StandardController.cpp @@ -55,6 +55,9 @@ Input::NamedVector StandardController::getAvailableInputs() const { makePair(LS, "LS"), makePair(RS, "RS"), + makePair(LS, "LS_TOUCH"), + makePair(RS, "RS_TOUCH"), + // Center buttons makePair(START, "Start"), makePair(BACK, "Back"), @@ -69,26 +72,41 @@ Input::NamedVector StandardController::getAvailableInputs() const { makePair(LT, "LT"), makePair(RT, "RT"), - // Finger abstractions makePair(LEFT_PRIMARY_THUMB, "LeftPrimaryThumb"), makePair(LEFT_SECONDARY_THUMB, "LeftSecondaryThumb"), + makePair(LEFT_THUMB_UP, "LeftThumbUp"), makePair(RIGHT_PRIMARY_THUMB, "RightPrimaryThumb"), makePair(RIGHT_SECONDARY_THUMB, "RightSecondaryThumb"), + makePair(RIGHT_THUMB_UP, "RightThumbUp"), + + makePair(LEFT_PRIMARY_THUMB_TOUCH, "LeftPrimaryThumbTouch"), + makePair(LEFT_SECONDARY_THUMB_TOUCH, "LeftSecondaryThumbTouch"), + makePair(RIGHT_PRIMARY_THUMB_TOUCH, "RightPrimaryThumbTouch"), + makePair(RIGHT_SECONDARY_THUMB_TOUCH, "RightSecondaryThumbTouch"), + + makePair(LEFT_INDEX_POINT, "LeftIndexPoint"), + makePair(RIGHT_INDEX_POINT, "RightIndexPoint"), makePair(LEFT_PRIMARY_INDEX, "LeftPrimaryIndex"), makePair(LEFT_SECONDARY_INDEX, "LeftSecondaryIndex"), makePair(RIGHT_PRIMARY_INDEX, "RightPrimaryIndex"), makePair(RIGHT_SECONDARY_INDEX, "RightSecondaryIndex"), + makePair(LEFT_PRIMARY_INDEX_TOUCH, "LeftPrimaryIndexTouch"), + makePair(LEFT_SECONDARY_INDEX_TOUCH, "LeftSecondaryIndexTouch"), + makePair(RIGHT_PRIMARY_INDEX_TOUCH, "RightPrimaryIndexTouch"), + makePair(RIGHT_SECONDARY_INDEX_TOUCH, "RightSecondaryIndexTouch"), + makePair(LEFT_GRIP, "LeftGrip"), + makePair(LEFT_GRIP_TOUCH, "LeftGripTouch"), makePair(RIGHT_GRIP, "RightGrip"), + makePair(RIGHT_GRIP_TOUCH, "RightGripTouch"), // Poses makePair(LEFT_HAND, "LeftHand"), makePair(RIGHT_HAND, "RightHand"), - // Aliases, PlayStation style names makePair(LB, "L1"), makePair(RB, "R1"), diff --git a/libraries/controllers/src/controllers/StandardControls.h b/libraries/controllers/src/controllers/StandardControls.h index d5063f6034..bbd33c5cb3 100644 --- a/libraries/controllers/src/controllers/StandardControls.h +++ b/libraries/controllers/src/controllers/StandardControls.h @@ -39,16 +39,33 @@ namespace controller { // These don't map to SDL types LEFT_PRIMARY_THUMB, LEFT_SECONDARY_THUMB, + LEFT_PRIMARY_THUMB_TOUCH, + LEFT_SECONDARY_THUMB_TOUCH, + LS_TOUCH, + LEFT_THUMB_UP, + RIGHT_PRIMARY_THUMB, RIGHT_SECONDARY_THUMB, + RIGHT_PRIMARY_THUMB_TOUCH, + RIGHT_SECONDARY_THUMB_TOUCH, + RS_TOUCH, + RIGHT_THUMB_UP, LEFT_PRIMARY_INDEX, LEFT_SECONDARY_INDEX, + LEFT_PRIMARY_INDEX_TOUCH, + LEFT_SECONDARY_INDEX_TOUCH, + LEFT_INDEX_POINT, RIGHT_PRIMARY_INDEX, RIGHT_SECONDARY_INDEX, + RIGHT_PRIMARY_INDEX_TOUCH, + RIGHT_SECONDARY_INDEX_TOUCH, + RIGHT_INDEX_POINT, LEFT_GRIP, + LEFT_GRIP_TOUCH, RIGHT_GRIP, + RIGHT_GRIP_TOUCH, NUM_STANDARD_BUTTONS }; From 02288e84e8017943f2507d4be87dc11985f39712 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Mon, 2 Nov 2015 15:35:30 -0800 Subject: [PATCH 10/12] CR feedback --- libraries/controllers/src/controllers/StandardController.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/controllers/src/controllers/StandardController.cpp b/libraries/controllers/src/controllers/StandardController.cpp index 5b68f38374..fadbeee326 100644 --- a/libraries/controllers/src/controllers/StandardController.cpp +++ b/libraries/controllers/src/controllers/StandardController.cpp @@ -55,8 +55,8 @@ Input::NamedVector StandardController::getAvailableInputs() const { makePair(LS, "LS"), makePair(RS, "RS"), - makePair(LS, "LS_TOUCH"), - makePair(RS, "RS_TOUCH"), + makePair(LS_TOUCH, "LSTouch"), + makePair(RS_TOUCH, "RSTouch"), // Center buttons makePair(START, "Start"), From 0a5f43bba78732ad3d31bc031bcf21c5fde4dbad Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 2 Nov 2015 16:16:13 -0800 Subject: [PATCH 11/12] fix up boolean test --- examples/controllers/handControllerGrab.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index b882777048..74c830616a 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -18,7 +18,7 @@ Script.include("../libraries/utils.js"); // // add lines where the hand ray picking is happening // -var WANT_DEBUG = false; +var WANT_DEBUG = true; // // these tune time-averaging and "on" value for analog trigger @@ -352,14 +352,14 @@ function MyController(hand) { var intersection = Entities.findRayIntersection(pickRayBacked, true); - if (intersection.intersects && intersection.properties.locked === 0) { + if (intersection.intersects && !intersection.properties.locked) { // the ray is intersecting something we can move. var intersectionDistance = Vec3.distance(pickRay.origin, intersection.intersection); this.grabbedEntity = intersection.entityID; //this code will disabled the beam for the opposite hand of the one that grabbed it if the entity says so var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, intersection.entityID, DEFAULT_GRABBABLE_DATA); - if (grabbableData["turnOffOppositeBeam"] === true) { + if (grabbableData["turnOffOppositeBeam"]) { if (this.hand === RIGHT_HAND) { disabledHand = LEFT_HAND; } else { @@ -369,7 +369,7 @@ function MyController(hand) { disabledHand = 'none'; } - if (grabbableData.grabbable === false) { + if (!grabbableData.grabbable) { this.grabbedEntity = null; continue; } @@ -391,7 +391,7 @@ function MyController(hand) { this.grabbedEntity = null; } else { // the hand is far from the intersected object. go into distance-holding mode - if (intersection.properties.collisionsWillMove === 1) { + if (intersection.properties.collisionsWillMove) { this.setState(STATE_DISTANCE_HOLDING); } else { this.setState(STATE_FAR_GRABBING_NON_COLLIDING); @@ -409,7 +409,7 @@ function MyController(hand) { for (i = 0; i < nearbyEntities.length; i++) { var grabbableDataForCandidate = getEntityCustomData(GRABBABLE_DATA_KEY, nearbyEntities[i], DEFAULT_GRABBABLE_DATA); - if (grabbableDataForCandidate.grabbable === false) { + if (!grabbableDataForCandidate.grabbable) { continue; } var propsForCandidate = @@ -427,7 +427,7 @@ function MyController(hand) { } if (grabbableData.wantsTrigger) { this.setState(STATE_NEAR_GRABBING_NON_COLLIDING); - } else if (props.locked === 0) { + } else if (!props.locked) { this.setState(STATE_NEAR_GRABBING); } } @@ -569,7 +569,7 @@ function MyController(hand) { var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA); var turnOffOtherHand = grabbableData["turnOffOtherHand"]; - if (turnOffOtherHand === true) { + if (turnOffOtherHand) { //don't activate the second hand grab because the script is handling the second hand logic return; } @@ -782,11 +782,11 @@ function MyController(hand) { // we haven't been touched before, but either right or left is touching us now _this.allTouchedIDs[id] = true; _this.startTouch(id); - } else if ((leftIsTouching || rightIsTouching) && _this.allTouchedIDs[id] === true) { + } else if ((leftIsTouching || rightIsTouching) && _this.allTouchedIDs[id]) { // we have been touched before and are still being touched // continue touch _this.continueTouch(id); - } else if (_this.allTouchedIDs[id] === true) { + } else if (_this.allTouchedIDs[id]) { delete _this.allTouchedIDs[id]; _this.stopTouch(id); From fe2c0effd04099c4c6cd256cb74af6b40f0667ef Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 2 Nov 2015 16:17:46 -0800 Subject: [PATCH 12/12] oops left debug on --- examples/controllers/handControllerGrab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index 74c830616a..30c99f43f8 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -18,7 +18,7 @@ Script.include("../libraries/utils.js"); // // add lines where the hand ray picking is happening // -var WANT_DEBUG = true; +var WANT_DEBUG = false; // // these tune time-averaging and "on" value for analog trigger