From afab5f1cbf5996147bf08288a41771fe77b2ccaa Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 18 Jun 2014 20:52:17 -0700 Subject: [PATCH 1/3] Fix startup crash where Hydra controllers are not properly plugged in Crash occurs if the left controller is plugged in but right one isn't. --- interface/src/avatar/SkeletonModel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 576545f115..af070a91bd 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -66,7 +66,7 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) { hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex); const float HAND_RESTORATION_RATE = 0.25f; - if (leftPalmIndex == -1) { + if (leftPalmIndex == -1 || rightPalmIndex == -1) { // palms are not yet set, use mouse if (_owningAvatar->getHandState() == HAND_STATE_NULL) { restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); From 641b9e8253fdc474ad9f077358c3c3be64702915 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 19 Jun 2014 10:43:25 -0700 Subject: [PATCH 2/3] Set minimum angular size too model selection --- examples/editModels.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/editModels.js b/examples/editModels.js index eebcd075fa..d2670f59bf 100644 --- a/examples/editModels.js +++ b/examples/editModels.js @@ -34,6 +34,7 @@ var LASER_COLOR = { red: 255, green: 0, blue: 0 }; var LASER_LENGTH_FACTOR = 500 ; +var MIN_ANGULAR_SIZE = 2; var MAX_ANGULAR_SIZE = 45; var LEFT = 0; @@ -828,8 +829,9 @@ function mousePressEvent(event) { var X = Vec3.sum(A, Vec3.multiply(B, x)); var d = Vec3.length(Vec3.subtract(P, X)); - if (0 < x && x < LASER_LENGTH_FACTOR) { - if (2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14 < MAX_ANGULAR_SIZE) { + var angularSize = 2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14; + if (0 < x && angularSize > MIN_ANGULAR_SIZE) { + if (angularSize < MAX_ANGULAR_SIZE) { modelSelected = true; selectedModelID = foundModel; selectedModelProperties = properties; From 676141024a8a63a33664b3cd461709eaf44af17d Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 19 Jun 2014 10:46:06 -0700 Subject: [PATCH 3/3] Added angular size limit to hydras too. --- examples/editModels.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/editModels.js b/examples/editModels.js index d2670f59bf..8a73c79532 100644 --- a/examples/editModels.js +++ b/examples/editModels.js @@ -278,8 +278,9 @@ function controller(wichSide) { var X = Vec3.sum(A, Vec3.multiply(B, x)); var d = Vec3.length(Vec3.subtract(P, X)); - if (0 < x && x < LASER_LENGTH_FACTOR) { - if (2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14 > MAX_ANGULAR_SIZE) { + var angularSize = 2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14; + if (0 < x && angularSize > MIN_ANGULAR_SIZE) { + if (angularSize > MAX_ANGULAR_SIZE) { print("Angular size too big: " + 2 * Math.atan(properties.radius / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14); return { valid: false }; }