From 091de4a9b5fb601a387c984a84ca8b932bd29dcc Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Mon, 23 Jul 2018 22:33:47 +0300 Subject: [PATCH 01/10] Avatarapp: hover animate 'get more avatars' --- interface/resources/qml/hifi/AvatarApp.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/interface/resources/qml/hifi/AvatarApp.qml b/interface/resources/qml/hifi/AvatarApp.qml index 0a2dcb951b..9e0fdaa9f4 100644 --- a/interface/resources/qml/hifi/AvatarApp.qml +++ b/interface/resources/qml/hifi/AvatarApp.qml @@ -682,6 +682,14 @@ Rectangle { PropertyChanges { target: container; y: -5 } PropertyChanges { target: favoriteAvatarImage; dropShadowRadius: 10 } PropertyChanges { target: favoriteAvatarImage; dropShadowVerticalOffset: 6 } + }, + State { + name: "getMoreAvatarsHovered" + when: getMoreAvatarsMouseArea.containsMouse; + PropertyChanges { target: getMoreAvatarsMouseArea; anchors.bottomMargin: -5 } + PropertyChanges { target: container; y: -5 } + PropertyChanges { target: getMoreAvatarsImage; dropShadowRadius: 10 } + PropertyChanges { target: getMoreAvatarsImage; dropShadowVerticalOffset: 6 } } ] @@ -741,6 +749,7 @@ Rectangle { } ShadowRectangle { + id: getMoreAvatarsImage width: 92 height: 92 radius: 5 @@ -756,7 +765,9 @@ Rectangle { } MouseArea { + id: getMoreAvatarsMouseArea anchors.fill: parent + hoverEnabled: true onClicked: { popup.showBuyAvatars(function() { From 6e23caca0dd15b01d6aa63ad69e4f2272a9c4132 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Thu, 26 Jul 2018 20:25:42 +0200 Subject: [PATCH 02/10] handle both wantsTrigger and triggerable in CreateApp --- scripts/system/html/entityProperties.html | 4 +-- scripts/system/html/js/entityProperties.js | 31 ++++++++++++++-------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/scripts/system/html/entityProperties.html b/scripts/system/html/entityProperties.html index 8d63261f4c..9614f8b8fe 100644 --- a/scripts/system/html/entityProperties.html +++ b/scripts/system/html/entityProperties.html @@ -126,8 +126,8 @@
- - + +
diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index a6a781b35f..59186bf38f 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -308,9 +308,10 @@ function setUserDataFromEditor(noUpdate) { } } -function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) { +function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults, removeKeys) { var properties = {}; var parsedData = {}; + var keysToBeRemoved = removeKeys ? removeKeys : []; try { if ($('#userdata-editor').css('height') !== "0px") { // if there is an expanded, we want to use its json. @@ -342,6 +343,12 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) { parsedData[groupName][key] = defaults[key]; } }); + keysToBeRemoved.forEach(function(key) { + if (parsedData[groupName].hasOwnProperty(key)) { + delete parsedData[groupName][key]; + } + }); + if (Object.keys(parsedData[groupName]).length === 0) { delete parsedData[groupName]; } @@ -355,11 +362,11 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) { updateProperties(properties); } -function userDataChanger(groupName, keyName, values, userDataElement, defaultValue) { +function userDataChanger(groupName, keyName, values, userDataElement, defaultValue, removeKeys) { var val = {}, def = {}; val[keyName] = values; def[keyName] = defaultValue; - multiDataUpdater(groupName, val, userDataElement, def); + multiDataUpdater(groupName, val, userDataElement, def, removeKeys); } function setMaterialDataFromEditor(noUpdate) { @@ -711,7 +718,7 @@ function loaded() { var elCloneableLifetime = document.getElementById("property-cloneable-lifetime"); var elCloneableLimit = document.getElementById("property-cloneable-limit"); - var elWantsTrigger = document.getElementById("property-wants-trigger"); + var elTriggerable = document.getElementById("property-triggerable"); var elIgnoreIK = document.getElementById("property-ignore-ik"); var elLifetime = document.getElementById("property-lifetime"); @@ -1037,7 +1044,7 @@ function loaded() { elGrabbable.checked = properties.dynamic; - elWantsTrigger.checked = false; + elTriggerable.checked = false; elIgnoreIK.checked = true; elCloneable.checked = properties.cloneable; @@ -1060,10 +1067,12 @@ function loaded() { } else { elGrabbable.checked = true; } - if ("wantsTrigger" in grabbableData) { - elWantsTrigger.checked = grabbableData.wantsTrigger; + if ("triggerable" in grabbableData) { + elTriggerable.checked = grabbableData.triggerable; + } else if ("wantsTrigger" in grabbableData) { + elTriggerable.checked = grabbableData.wantsTrigger; } else { - elWantsTrigger.checked = false; + elTriggerable.checked = false; } if ("ignoreIK" in grabbableData) { elIgnoreIK.checked = grabbableData.ignoreIK; @@ -1076,7 +1085,7 @@ function loaded() { } if (!grabbablesSet) { elGrabbable.checked = true; - elWantsTrigger.checked = false; + elTriggerable.checked = false; elIgnoreIK.checked = true; elCloneable.checked = false; } @@ -1447,8 +1456,8 @@ function loaded() { elCloneableLifetime.addEventListener('change', createEmitNumberPropertyUpdateFunction('cloneLifetime')); elCloneableLimit.addEventListener('change', createEmitNumberPropertyUpdateFunction('cloneLimit')); - elWantsTrigger.addEventListener('change', function() { - userDataChanger("grabbableKey", "wantsTrigger", elWantsTrigger, elUserData, false); + elTriggerable.addEventListener('change', function() { + userDataChanger("grabbableKey", "triggerable", elTriggerable, elUserData, false, ['wantsTrigger']); }); elIgnoreIK.addEventListener('change', function() { userDataChanger("grabbableKey", "ignoreIK", elIgnoreIK, elUserData, true); From 6edd109dfe3c6ffa6472388e6a307d92512df6c0 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 26 Jul 2018 15:23:54 -0700 Subject: [PATCH 03/10] revert back to the old way we checkForChildTooFarAway --- .../controllerModules/nearParentGrabEntity.js | 4 ++-- .../libraries/controllerDispatcherUtils.js | 19 ------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index 38334f5523..81d2116eff 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -22,7 +22,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); // XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true; // XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC; - + Script.include("/~/system/libraries/controllers"); function NearParentingGrabEntity(hand) { this.hand = hand; this.targetEntityID = null; @@ -174,7 +174,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); this.lastUnequipCheckTime = now; if (props.parentID === MyAvatar.SELF_ID) { var tearAwayDistance = TEAR_AWAY_DISTANCE * MyAvatar.sensorToWorldScale; - var distance = distanceBetweenEntityLocalPositionAndBoundingBox(props); + var distance = distanceBetweenPointAndEntityBoundingBox(props); if (distance > tearAwayDistance) { this.autoUnequipCounter++; } else { diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index e817bb4ee1..717ec2aa80 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -416,25 +416,6 @@ findHandChildEntities = function(hand) { }); }; -distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps) { - var localPoint = entityProps.localPosition; - var entityXform = new Xform(entityProps.rotation, entityProps.position); - var minOffset = Vec3.multiplyVbyV(entityProps.registrationPoint, entityProps.dimensions); - var maxOffset = Vec3.multiplyVbyV(Vec3.subtract(ONE_VEC, entityProps.registrationPoint), entityProps.dimensions); - var localMin = Vec3.subtract(entityXform.trans, minOffset); - var localMax = Vec3.sum(entityXform.trans, maxOffset); - - var v = {x: localPoint.x, y: localPoint.y, z: localPoint.z}; - v.x = Math.max(v.x, localMin.x); - v.x = Math.min(v.x, localMax.x); - v.y = Math.max(v.y, localMin.y); - v.y = Math.min(v.y, localMax.y); - v.z = Math.max(v.z, localMin.z); - v.z = Math.min(v.z, localMax.z); - - return Vec3.distance(v, localPoint); -}; - distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) { var entityXform = new Xform(entityProps.rotation, entityProps.position); var localPoint = entityXform.inv().xformPoint(point); From 31d31af941d76d2bd37f7e3b7a0e30e30d8c4211 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 26 Jul 2018 16:05:18 -0700 Subject: [PATCH 04/10] minimize diff --- .../system/controllers/controllerModules/nearParentGrabEntity.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index 81d2116eff..4c77cd62c7 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -22,7 +22,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); // XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true; // XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC; - Script.include("/~/system/libraries/controllers"); function NearParentingGrabEntity(hand) { this.hand = hand; this.targetEntityID = null; From 74bb2301b07e86b93aa5139b9253bb954e36ce12 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 26 Jul 2018 16:05:56 -0700 Subject: [PATCH 05/10] minimize diff --- .../system/controllers/controllerModules/nearParentGrabEntity.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index 4c77cd62c7..1cfaf87852 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -22,6 +22,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); // XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true; // XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC; + function NearParentingGrabEntity(hand) { this.hand = hand; this.targetEntityID = null; From 6320401308569e1e95de7fe18d6e272be9cd536d Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 27 Jul 2018 17:49:49 -0700 Subject: [PATCH 06/10] somewhat better distance from bounding box --- .../controllerModules/nearParentGrabEntity.js | 18 +++++++++++- .../libraries/controllerDispatcherUtils.js | 28 +++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index 1cfaf87852..c26285cdcc 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -23,6 +23,20 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); // XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true; // XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC; + var GRAB_POINT_SPHERE_OFFSET = { x: 0.01, y: -0.13, z: 0.039 }; + + function getGrabPointSphereOffset(handController) { + var offset = GRAB_POINT_SPHERE_OFFSET; + if (handController === Controller.Standard.LeftHand) { + offset = { + x: -GRAB_POINT_SPHERE_OFFSET.x, + y: GRAB_POINT_SPHERE_OFFSET.y, + z: GRAB_POINT_SPHERE_OFFSET.z + }; + } + return Vec3.multiply(MyAvatar.sensorToWorldScale, offset); + } + function NearParentingGrabEntity(hand) { this.hand = hand; this.targetEntityID = null; @@ -174,7 +188,9 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); this.lastUnequipCheckTime = now; if (props.parentID === MyAvatar.SELF_ID) { var tearAwayDistance = TEAR_AWAY_DISTANCE * MyAvatar.sensorToWorldScale; - var distance = distanceBetweenPointAndEntityBoundingBox(props); + var controllerIndex = (this.hand === LEFT_HAND ? Controller.Standard.LeftHand : Controller.Standard.RightHand); + var controllerGrabOffset = getGrabPointSphereOffset(controllerIndex); + var distance = distanceBetweenEntityLocalPositionAndBoundingBox(props, controllerGrabOffset); if (distance > tearAwayDistance) { this.autoUnequipCounter++; } else { diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index 717ec2aa80..1926b77d04 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -58,7 +58,7 @@ entityIsFarGrabbedByOther:true, highlightTargetEntity:true, clearHighlightedEntities:true, - unhighlightTargetEntity:true + unhighlightTargetEntity:true, distanceBetweenEntityLocalPositionAndBoundingBox: true */ @@ -95,7 +95,7 @@ COLORS_GRAB_DISTANCE_HOLD = { red: 238, green: 75, blue: 214 }; NEAR_GRAB_RADIUS = 1.0; -TEAR_AWAY_DISTANCE = 0.1; // ungrab an entity if its bounding-box moves this far from the hand +TEAR_AWAY_DISTANCE = 0.2; // ungrab an entity if its bounding-box moves this far from the hand TEAR_AWAY_COUNT = 2; // multiply by TEAR_AWAY_CHECK_TIME to know how long the item must be away TEAR_AWAY_CHECK_TIME = 0.15; // seconds, duration between checks DISPATCHER_HOVERING_LIST = "dispactherHoveringList"; @@ -416,6 +416,30 @@ findHandChildEntities = function(hand) { }); }; +distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps, jointGrabOffset) { + var DEFAULT_REGISTRATION_POINT = { x: 0.5, y: 0.5, z: 0.5 }; + var rotInv = Quat.inverse(entityProps.localRotation); + var localPosition = Vec3.sum(entityProps.localPosition, jointGrabOffset); + var localPoint = Vec3.multiplyQbyV(rotInv, Vec3.multiply(localPosition, -1.0)); + + var halfDims = Vec3.multiply(entityProps.dimensions, 0.5); + var regRatio = Vec3.subtract(DEFAULT_REGISTRATION_POINT, entityProps.registrationPoint); + var entityCenter = Vec3.multiplyVbyV(regRatio, entityProps.dimensions); + var localMin = Vec3.subtract(entityCenter, halfDims); + var localMax = Vec3.sum(entityCenter, halfDims); + + if ((localMin.x < localPoint.x) && (localMin.y < localPoint.y) && (localMin.z < localPoint.z)) { + if ((localMax.x > localPoint.x) && (localMax.y > localPoint.y) && (localMax.z > localPoint.z)) { + return 0; + } + } + + + var distanceToLocalMax = Vec3.distance(localMax, localPoint); + var distanceToLocalMin = Vec3.distance(localMin, localPoint); + return Math.min(distanceToLocalMax, distanceToLocalMin); +}; + distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) { var entityXform = new Xform(entityProps.rotation, entityProps.position); var localPoint = entityXform.inv().xformPoint(point); From cf6850de48e678bbf1573f7448562d1e016ca890 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 27 Jul 2018 17:53:21 -0700 Subject: [PATCH 07/10] better stuff --- .../libraries/controllerDispatcherUtils.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index 1926b77d04..c562c9294b 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -428,16 +428,16 @@ distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps, jointGr var localMin = Vec3.subtract(entityCenter, halfDims); var localMax = Vec3.sum(entityCenter, halfDims); - if ((localMin.x < localPoint.x) && (localMin.y < localPoint.y) && (localMin.z < localPoint.z)) { - if ((localMax.x > localPoint.x) && (localMax.y > localPoint.y) && (localMax.z > localPoint.z)) { - return 0; - } - } + var v = {x: localPoint.x, y: localPoint.y, z: localPoint.z}; + v.x = Math.max(v.x, localMin.x); + v.x = Math.min(v.x, localMax.x); + v.y = Math.max(v.y, localMin.y); + v.y = Math.min(v.y, localMax.y); + v.z = Math.max(v.z, localMin.z); + v.z = Math.min(v.z, localMax.z); - var distanceToLocalMax = Vec3.distance(localMax, localPoint); - var distanceToLocalMin = Vec3.distance(localMin, localPoint); - return Math.min(distanceToLocalMax, distanceToLocalMin); + return Vec3.distance(v, localPoint); }; distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) { From 4caf613269a25c800c754fdde3180be7a87e4050 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 30 Jul 2018 10:19:27 -0700 Subject: [PATCH 08/10] making requested changes --- .../controllerModules/nearParentGrabEntity.js | 10 +++++----- scripts/system/libraries/controllerDispatcherUtils.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index c26285cdcc..7d22e3b232 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -23,15 +23,15 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); // XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true; // XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC; - var GRAB_POINT_SPHERE_OFFSET = { x: 0.01, y: -0.13, z: 0.039 }; + var GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE = { x: 0.01, y: -0.13, z: 0.039 }; function getGrabPointSphereOffset(handController) { - var offset = GRAB_POINT_SPHERE_OFFSET; + var offset = GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE; if (handController === Controller.Standard.LeftHand) { offset = { - x: -GRAB_POINT_SPHERE_OFFSET.x, - y: GRAB_POINT_SPHERE_OFFSET.y, - z: GRAB_POINT_SPHERE_OFFSET.z + x: -GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE.x, + y: GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE.y, + z: GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE.z }; } return Vec3.multiply(MyAvatar.sensorToWorldScale, offset); diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index c562c9294b..60c4553da7 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -95,7 +95,7 @@ COLORS_GRAB_DISTANCE_HOLD = { red: 238, green: 75, blue: 214 }; NEAR_GRAB_RADIUS = 1.0; -TEAR_AWAY_DISTANCE = 0.2; // ungrab an entity if its bounding-box moves this far from the hand +TEAR_AWAY_DISTANCE = 0.15; // ungrab an entity if its bounding-box moves this far from the hand TEAR_AWAY_COUNT = 2; // multiply by TEAR_AWAY_CHECK_TIME to know how long the item must be away TEAR_AWAY_CHECK_TIME = 0.15; // seconds, duration between checks DISPATCHER_HOVERING_LIST = "dispactherHoveringList"; From 0f46001f9a02e489e27a9a36c19e45ef388df5d5 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 30 Jul 2018 10:29:53 -0700 Subject: [PATCH 09/10] remove redundent variable --- .../controllerModules/nearParentGrabEntity.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index 7d22e3b232..a0a4608fbc 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -12,28 +12,29 @@ findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME, TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Uuid, highlightTargetEntity, unhighlightTargetEntity, - distanceBetweenEntityLocalPositionAndBoundingBox + distanceBetweenEntityLocalPositionAndBoundingBox, GRAB_POINT_SPHERE_OFFSET */ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/cloneEntityUtils.js"); +Script.include("/~/system/libraries/controllers.js"); (function() { // XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true; // XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC; - var GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE = { x: 0.01, y: -0.13, z: 0.039 }; - - function getGrabPointSphereOffset(handController) { - var offset = GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE; + function getGrabOffset(handController) { + var offset = GRAB_POINT_SPHERE_OFFSET; if (handController === Controller.Standard.LeftHand) { offset = { - x: -GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE.x, - y: GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE.y, - z: GRAB_POINT_SPHERE_OFFSET_IN_JOINT_SPACE.z + x: -GRAB_POINT_SPHERE_OFFSET.x, + y: GRAB_POINT_SPHERE_OFFSET.y, + z: GRAB_POINT_SPHERE_OFFSET.z }; } + + offset.y = -GRAB_POINT_SPHERE_OFFSET.y; return Vec3.multiply(MyAvatar.sensorToWorldScale, offset); } @@ -189,7 +190,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); if (props.parentID === MyAvatar.SELF_ID) { var tearAwayDistance = TEAR_AWAY_DISTANCE * MyAvatar.sensorToWorldScale; var controllerIndex = (this.hand === LEFT_HAND ? Controller.Standard.LeftHand : Controller.Standard.RightHand); - var controllerGrabOffset = getGrabPointSphereOffset(controllerIndex); + var controllerGrabOffset = getGrabOffset(controllerIndex); var distance = distanceBetweenEntityLocalPositionAndBoundingBox(props, controllerGrabOffset); if (distance > tearAwayDistance) { this.autoUnequipCounter++; From 63de16bac5cf4d68b91d9d9c91b401b1b30a7861 Mon Sep 17 00:00:00 2001 From: r3tk0n Date: Mon, 30 Jul 2018 11:40:15 -0700 Subject: [PATCH 10/10] Remove deprecated flying setting from MyAvatar.cpp saveData() --- interface/src/avatar/MyAvatar.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index e87dcc85cd..f0719f765e 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1137,7 +1137,6 @@ void MyAvatar::saveData() { settings.setValue("userHeight", getUserHeight()); settings.setValue("flyingDesktop", getFlyingDesktopPref()); settings.setValue("flyingHMD", getFlyingHMDPref()); - settings.setValue("enabledFlying", getFlyingEnabled()); settings.endGroup(); }