diff --git a/scripts/system/create/editModes/editVoxels.js b/scripts/system/create/editModes/editVoxels.js index 0e5e63caac2..53fae0ae7fb 100644 --- a/scripts/system/create/editModes/editVoxels.js +++ b/scripts/system/create/editModes/editVoxels.js @@ -22,8 +22,8 @@ // Script.include([ - "./libraries/utils.js", - "entitySelectionTool/entitySelectionTool.js" + "../../libraries/utils.js", + "../entitySelectionTool/entitySelectionTool.js" ]); var selectionManager = SelectionManager; @@ -337,6 +337,7 @@ EditVoxels = function() { var pickRay = generalComputePickRay(event.x, event.y); var intersection = Entities.findRayIntersection(pickRay, true); // accurate picking + var overlaysIntersection = Overlays.findRayIntersection(pickRay, true); // accurate picking if (wantDebug) { print("Pick ray: " + JSON.stringify(pickRay)); @@ -344,6 +345,17 @@ EditVoxels = function() { } if (intersection.intersects) { + if (overlaysIntersection.intersects) { + var overlaysIntersectionDistance = Vec3.distance(overlaysIntersection.intersection, pickRay.origin); + var intersectionDistance = Vec3.distance(intersection.intersection, pickRay.origin); + if (wantDebug) { + print("overlaysIntersectionDistance: " + overlaysIntersectionDistance); + print("intersectionDistance: " + intersectionDistance); + } + if (overlaysIntersectionDistance < intersectionDistance) { + return; + } + } if (attemptVoxelChangeForEntity(intersection.entityID, pickRay.direction, intersection.intersection)) { Script.update.connect(onUpdateHandler); isOnUpdateConnected = true; @@ -409,16 +421,6 @@ EditVoxels = function() { return that.triggeredHand !== NO_HAND; }; - function pointingAtDesktopWindowOrTablet(hand) { - var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && - SelectionManager.pointingAtDesktopWindowRight) || - (hand === Controller.Standard.LeftHand && - SelectionManager.pointingAtDesktopWindowLeft); - var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || - (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); - return pointingAtDesktopWindow || pointingAtTablet; - } - function makeClickHandler(hand) { return function (clicked) { if (!editEnabled) { @@ -428,7 +430,7 @@ EditVoxels = function() { if (triggered() && hand !== that.triggeredHand) { return; } - if (!triggered() && clicked && !pointingAtDesktopWindowOrTablet(hand)) { + if (!triggered() && clicked) { that.triggeredHand = hand; mousePressEvent({}); } else if (triggered() && !clicked) { @@ -443,7 +445,7 @@ EditVoxels = function() { if (!editEnabled) { return; } - if (value >= TRIGGER_ON_VALUE && !triggered() && !pointingAtDesktopWindowOrTablet(hand)) { + if (value >= TRIGGER_ON_VALUE && !triggered()) { that.pressedHand = hand; } else { that.pressedHand = NO_HAND; diff --git a/scripts/system/create/entitySelectionTool/entitySelectionTool.js b/scripts/system/create/entitySelectionTool/entitySelectionTool.js index c5d4838917f..f5469bada76 100644 --- a/scripts/system/create/entitySelectionTool/entitySelectionTool.js +++ b/scripts/system/create/entitySelectionTool/entitySelectionTool.js @@ -130,6 +130,11 @@ SelectionManager = (function() { audioFeedback.action(); } } else { + var pickRay = SelectionDisplay.controllerComputePickRay(); + var intersectObj = SelectionDisplay.testRayIntersect(pickRay, SelectionDisplay.allToolEntities); + if (intersectObj.intersects) { + return; + } if (hmdMultiSelectMode) { that.addEntity(messageParsed.entityID, true, that); } else { @@ -1253,6 +1258,8 @@ SelectionDisplay = (function() { zRailToolEntity ]; + that.allToolEntities = allToolEntities; + const nonLayeredToolEntities = [selectionBox, iconSelectionBox]; var maximumHandleInAllToolEntities = handleDuplicator; @@ -1419,6 +1426,8 @@ SelectionDisplay = (function() { return intersectObj; } + that.testRayIntersect = testRayIntersect; + function isPointInsideBox(point, box) { var position = Vec3.subtract(point, box.position); position = Vec3.multiplyQbyV(Quat.inverse(box.rotation), position); @@ -1784,6 +1793,8 @@ SelectionDisplay = (function() { } } + that.controllerComputePickRay = controllerComputePickRay; + function generalComputePickRay(x, y) { return controllerComputePickRay() || Camera.computePickRay(x, y); } diff --git a/scripts/system/create/qml/NewPolyVoxDialog.qml b/scripts/system/create/qml/NewPolyVoxDialog.qml index 8a8b77818ba..0f8ab5541da 100644 --- a/scripts/system/create/qml/NewPolyVoxDialog.qml +++ b/scripts/system/create/qml/NewPolyVoxDialog.qml @@ -302,7 +302,7 @@ Rectangle { width: 50 anchors.left: textVolumeSizeX.right anchors.leftMargin: 3 - text: qsTr("16") + text: qsTr("20") color: "white" font.pixelSize: 12 validator: IntValidator{bottom: 8; top: 64;} @@ -344,7 +344,7 @@ Rectangle { width: 50 anchors.left: textVolumeSizeY.right anchors.leftMargin: 3 - text: qsTr("16") + text: qsTr("20") color: "white" font.pixelSize: 12 validator: IntValidator{bottom: 8; top: 64;} @@ -385,7 +385,7 @@ Rectangle { width: 50 anchors.left: textVolumeSizeZ.right anchors.leftMargin: 3 - text: qsTr("16") + text: qsTr("20") color: "white" font.pixelSize: 12 validator: IntValidator{bottom: 8; top: 64;}