From 0c2ebc27cbf8503d2f87b597836d31b1b3cf3eb3 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 7 Oct 2016 14:48:55 -0700 Subject: [PATCH 1/3] Fix for exception in handControllerGrab.js Specifically this: [UncaughtException] TypeError: Result of expression 'this.handToController' [undefined] is not a function. in file:///C:/msys64/home/anthony/code/hifi/build/interface/Release/scripts/defaultScripts.js:1388 --- scripts/system/controllers/handControllerGrab.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 954093854e..f0f6f85dd8 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1382,10 +1382,11 @@ function MyController(hand) { this.chooseBestEquipHotspot = function(candidateEntities) { var DISTANCE = 0; var equippableHotspots = this.chooseNearEquipHotspots(candidateEntities, DISTANCE); + var _this = this; if (equippableHotspots.length > 0) { // sort by distance equippableHotspots.sort(function(a, b) { - var handControllerLocation = getControllerWorldLocation(this.handToController(), true); + var handControllerLocation = getControllerWorldLocation(_this.handToController(), true); var aDistance = Vec3.distance(a.worldPosition, handControllerLocation.position); var bDistance = Vec3.distance(b.worldPosition, handControllerLocation.position); return aDistance - bDistance; From 7c7a9055d1eed3fede2c42bb255b5131edbd52e0 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 7 Oct 2016 14:50:00 -0700 Subject: [PATCH 2/3] Allow grabbed objects to override the ignoreIK = true default. They can do this by adding the following to their userData. grabbableKey: { ignoreIK: false } When this is present and false, the object will follow the hand joint, otherwise it will follow the hand controller. --- scripts/system/controllers/handControllerGrab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index f0f6f85dd8..83bb7231ba 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -26,7 +26,7 @@ var WANT_DEBUG = false; var WANT_DEBUG_STATE = false; var WANT_DEBUG_SEARCH_NAME = null; -var FORCE_IGNORE_IK = true; +var FORCE_IGNORE_IK = false; var SHOW_GRAB_POINT_SPHERE = true; // @@ -1901,7 +1901,7 @@ function MyController(hand) { if (FORCE_IGNORE_IK) { this.ignoreIK = true; } else { - this.ignoreIK = grabbableData.ignoreIK ? grabbableData.ignoreIK : false; + this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true; } var handRotation; From f76dbeeffd9ab818d3508d22be2fd00d0b7e3dcd Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Tue, 11 Oct 2016 17:12:02 -0700 Subject: [PATCH 3/3] Edit.js now works with new ignoreIK default --- scripts/system/html/js/entityProperties.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 67aa8bdb13..0bcae7f409 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -830,7 +830,7 @@ function loaded() { elGrabbable.checked = properties.dynamic; elWantsTrigger.checked = false; - elIgnoreIK.checked = false; + elIgnoreIK.checked = true; var parsedUserData = {} try { parsedUserData = JSON.parse(properties.userData); @@ -1143,7 +1143,7 @@ function loaded() { userDataChanger("grabbableKey", "wantsTrigger", elWantsTrigger, elUserData, false); }); elIgnoreIK.addEventListener('change', function() { - userDataChanger("grabbableKey", "ignoreIK", elIgnoreIK, elUserData, false); + userDataChanger("grabbableKey", "ignoreIK", elIgnoreIK, elUserData, true); }); elCollisionSoundURL.addEventListener('change', createEmitTextPropertyUpdateFunction('collisionSoundURL')); @@ -1596,4 +1596,4 @@ function loaded() { document.addEventListener("contextmenu", function(event) { event.preventDefault(); }, false); -} \ No newline at end of file +}