From 7fd88793dc3b41578680797152426b8a94c2a55b Mon Sep 17 00:00:00 2001 From: PhilipRosedale Date: Fri, 26 Feb 2016 16:41:37 -0800 Subject: [PATCH 1/8] drag relative to plane where pointer collided selection box --- examples/edit.js | 5 ++- examples/libraries/entitySelectionTool.js | 39 +++++++++++++++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 50a66ea31f..fc04a0b26f 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -758,7 +758,8 @@ function findClickedEntity(event) { var foundEntity = result.entityID; return { pickRay: pickRay, - entityID: foundEntity + entityID: foundEntity, + intersection: result.intersection }; } @@ -978,6 +979,8 @@ function mouseClickEvent(event) { if (!event.isShifted) { selectionManager.setSelections([foundEntity]); + Vec3.print("found object, intersection = ", result.intersection); + selectionManager.setPickPlanePosition(result.intersection); } else { selectionManager.addEntity(foundEntity, true); } diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index c1675ef044..6a7247aa57 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -16,6 +16,11 @@ HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; SPACE_LOCAL = "local"; SPACE_WORLD = "world"; +function objectTranslationPlanePoint(position, dimensions) { + var newPosition = { x: position.x, y: position.y, z: position.z }; + newPosition.y -= dimensions.y / 2.0; + return newPosition; +} SelectionManager = (function() { var that = {}; @@ -82,6 +87,11 @@ SelectionManager = (function() { y: 0, z: 0 }; + that.pickPlanePosition = { + x: 0, + y: 0, + z: 0 + }; that.saveProperties = function() { that.savedProperties = {}; @@ -109,6 +119,13 @@ SelectionManager = (function() { that._update(); }; + that.setPickPlanePosition = function(position) { + that.pickPlanePosition.x = position.x; + that.pickPlanePosition.y = position.y; + that.pickPlanePosition.z = position.z; + Vec3.print("that.pickPlanePosition = ", that.pickPlanePosition); + }; + that.addEntity = function(entityID, toggleSelection) { if (entityID) { var idx = -1; @@ -2252,15 +2269,17 @@ SelectionDisplay = (function() { var constrainMajorOnly = false; var startPosition = null; var duplicatedEntityIDs = null; + var translateXZTool = { mode: 'TRANSLATE_XZ', + pickPlanePosition: { x: 0, y: 0, z: 0 }, onBegin: function(event) { SelectionManager.saveProperties(); startPosition = SelectionManager.worldPosition; var dimensions = SelectionManager.worldDimensions; var pickRay = Camera.computePickRay(event.x, event.y); - initialXZPick = rayPlaneIntersection(pickRay, startPosition, { + initialXZPick = rayPlaneIntersection(pickRay, translateXZTool.pickPlanePosition, { x: 0, y: 1, z: 0 @@ -2300,13 +2319,23 @@ SelectionDisplay = (function() { onMove: function(event) { pickRay = Camera.computePickRay(event.x, event.y); - var pick = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, { + var pick = rayPlaneIntersection(pickRay, translateXZTool.pickPlanePosition, { x: 0, y: 1, z: 0 }); + var vector = Vec3.subtract(pick, initialXZPick); + Vec3.print("Pick Plane Position", translateXZTool.pickPlanePosition); + + /* + if (pickRay.origin.y < this.pickPlanePosition.y) { + vector.x *= -1.0; + vector.z *= -1.0; + } */ + + // If shifted, constrain to one axis if (event.isShifted) { if (Math.abs(vector.x) > Math.abs(vector.z)) { @@ -2645,11 +2674,6 @@ SelectionDisplay = (function() { pickRayPosition, planeNormal); - // Overlays.editOverlay(normalLine, { - // start: initialPosition, - // end: Vec3.sum(Vec3.multiply(100000, planeNormal), initialPosition), - // }); - SelectionManager.saveProperties(); }; @@ -4093,6 +4117,7 @@ SelectionDisplay = (function() { switch (result.overlayID) { case selectionBox: activeTool = translateXZTool; + translateXZTool.pickPlanePosition = result.intersection; mode = translateXZTool.mode; activeTool.onBegin(event); somethingClicked = true; From 47504a068ee43969869c3e426c2ba2427b7316b3 Mon Sep 17 00:00:00 2001 From: PhilipRosedale Date: Fri, 26 Feb 2016 16:50:37 -0800 Subject: [PATCH 2/8] remove unused code --- examples/edit.js | 2 -- examples/libraries/entitySelectionTool.js | 21 --------------------- 2 files changed, 23 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index fc04a0b26f..0e252bdf86 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -979,8 +979,6 @@ function mouseClickEvent(event) { if (!event.isShifted) { selectionManager.setSelections([foundEntity]); - Vec3.print("found object, intersection = ", result.intersection); - selectionManager.setPickPlanePosition(result.intersection); } else { selectionManager.addEntity(foundEntity, true); } diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index 6a7247aa57..015e169908 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -87,11 +87,6 @@ SelectionManager = (function() { y: 0, z: 0 }; - that.pickPlanePosition = { - x: 0, - y: 0, - z: 0 - }; that.saveProperties = function() { that.savedProperties = {}; @@ -119,13 +114,6 @@ SelectionManager = (function() { that._update(); }; - that.setPickPlanePosition = function(position) { - that.pickPlanePosition.x = position.x; - that.pickPlanePosition.y = position.y; - that.pickPlanePosition.z = position.z; - Vec3.print("that.pickPlanePosition = ", that.pickPlanePosition); - }; - that.addEntity = function(entityID, toggleSelection) { if (entityID) { var idx = -1; @@ -2327,15 +2315,6 @@ SelectionDisplay = (function() { var vector = Vec3.subtract(pick, initialXZPick); - Vec3.print("Pick Plane Position", translateXZTool.pickPlanePosition); - - /* - if (pickRay.origin.y < this.pickPlanePosition.y) { - vector.x *= -1.0; - vector.z *= -1.0; - } */ - - // If shifted, constrain to one axis if (event.isShifted) { if (Math.abs(vector.x) > Math.abs(vector.z)) { From 1d681a24618fa4bfe35f55de4eae40006a0970c7 Mon Sep 17 00:00:00 2001 From: PhilipRosedale Date: Sun, 28 Feb 2016 12:00:13 -0800 Subject: [PATCH 3/8] Add angular size and azimuth limits to object XZ translation --- examples/edit.js | 22 ++++++++- examples/libraries/entitySelectionTool.js | 56 +++++++++++++++++++++-- 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 0e252bdf86..d77e017c47 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -711,9 +711,27 @@ var intersection; var SCALE_FACTOR = 200.0; -function rayPlaneIntersection(pickRay, point, normal) { +function rayPlaneIntersection(pickRay, point, normal) { // + // + // This version of the test returns the intersection of a line with a plane + // + var collides = Vec3.dot(pickRay.direction, normal); + var d = -Vec3.dot(point, normal); - var t = -(Vec3.dot(pickRay.origin, normal) + d) / Vec3.dot(pickRay.direction, normal); + var t = -(Vec3.dot(pickRay.origin, normal) + d) / collides; + + return Vec3.sum(pickRay.origin, Vec3.multiply(pickRay.direction, t)); +} + +function rayPlaneIntersection2(pickRay, point, normal) { + // + // This version of the test returns false if the ray is directed away from the plane + // + var collides = Vec3.dot(pickRay.direction, normal); + if (collides > 0.0) return false; + + var d = -Vec3.dot(point, normal); + var t = -(Vec3.dot(pickRay.origin, normal) + d) / collides; return Vec3.sum(pickRay.origin, Vec3.multiply(pickRay.direction, t)); } diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index 015e169908..0308a092ed 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -2261,6 +2261,10 @@ SelectionDisplay = (function() { var translateXZTool = { mode: 'TRANSLATE_XZ', pickPlanePosition: { x: 0, y: 0, z: 0 }, + greatestDimension: 0.0, + startingDistance: 0.0, + startingAzimuth: 0.0, + lastVector: { x: 0, y: 0, z: 0 }, onBegin: function(event) { SelectionManager.saveProperties(); startPosition = SelectionManager.worldPosition; @@ -2304,17 +2308,56 @@ SelectionDisplay = (function() { visible: false }); }, + azimuth: function(origin, intersection) { + return (origin.y - intersection.y) / Vec3.distance(origin, intersection); + }, onMove: function(event) { + var wantDebug = false; pickRay = Camera.computePickRay(event.x, event.y); - var pick = rayPlaneIntersection(pickRay, translateXZTool.pickPlanePosition, { + var pick = rayPlaneIntersection2(pickRay, translateXZTool.pickPlanePosition, { x: 0, y: 1, z: 0 }); + // If the pick ray doesn't hit the pick plane in this direction, do nothing. + // this will happen when someone drags across the horizon from the side they started on. + if (!pick) { + if (wantDebug) { + print("Pick ray does not intersect XZ plane."); + } + return; + } + var vector = Vec3.subtract(pick, initialXZPick); + // If the mouse is too close to the horizon of the pick plane, stop moving + var MIN_AZIMUTH = 0.02; // Radians + var azimuth = translateXZTool.azimuth(pickRay.origin, pick); + if ((translateXZTool.startingAzimuth > 0.0 && azimuth < MIN_AZIMUTH) || + (translateXZTool.startingAzimuth < 0.0 && azimuth > MIN_AZIMUTH)) { + //vector = translateXZTool.lastVector; + if (wantDebug) { + print("Azimuth = " + azimuth); + } + return; + } + + // If the angular size of the object is too small, stop moving + var MIN_ANGULAR_SIZE = 0.01; // Radians + if (translateXZTool.greatestDimension > 0) { + var angularSize = Math.atan(translateXZTool.greatestDimension / Vec3.distance(pickRay.origin, pick)); + if (wantDebug) { + print("Angular size = " + angularSize); + } + if (angularSize < MIN_ANGULAR_SIZE) { + return; + } + } + + translateXZTool.lastVector = vector; + // If shifted, constrain to one axis if (event.isShifted) { if (Math.abs(vector.x) > Math.abs(vector.z)) { @@ -2376,7 +2419,7 @@ SelectionDisplay = (function() { grid.snapToGrid(Vec3.sum(cornerPosition, vector), constrainMajorOnly), cornerPosition); - var wantDebug = false; + for (var i = 0; i < SelectionManager.selections.length; i++) { var properties = SelectionManager.savedProperties[SelectionManager.selections[i]]; @@ -3754,7 +3797,7 @@ SelectionDisplay = (function() { }; that.mousePressEvent = function(event) { - + if (!event.isLeftButton) { // if another mouse button than left is pressed ignore it return false; @@ -4097,6 +4140,13 @@ SelectionDisplay = (function() { case selectionBox: activeTool = translateXZTool; translateXZTool.pickPlanePosition = result.intersection; + translateXZTool.greatestDimension = Math.max(Math.max(SelectionManager.worldDimensions.x, SelectionManager.worldDimensions.y), + SelectionManager.worldDimensions.z); + print("longest dimension" + translateXZTool.greatestDimension); + translateXZTool.startingDistance = Vec3.distance(pickRay.origin, SelectionManager.position); + print("starting distance" + translateXZTool.startingDistance); + translateXZTool.startingAzimuth = translateXZTool.azimuth(pickRay.origin, translateXZTool.pickPlanePosition); + print("starting azimuth" + translateXZTool.startingAzimuth); mode = translateXZTool.mode; activeTool.onBegin(event); somethingClicked = true; From e9aed839205ec314733215c2febf1be85caa508b Mon Sep 17 00:00:00 2001 From: PhilipRosedale Date: Sun, 28 Feb 2016 12:41:40 -0800 Subject: [PATCH 4/8] suppress debug messages --- examples/edit.js | 14 +++++--- examples/libraries/entitySelectionTool.js | 42 +++++++++++++---------- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index d77e017c47..54311a8c42 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -945,6 +945,7 @@ function mouseReleaseEvent(event) { } function mouseClickEvent(event) { + var wantDebug = false; if (isActive && event.isLeftButton) { var result = findClickedEntity(event); if (result === null) { @@ -959,11 +960,15 @@ function mouseClickEvent(event) { var properties = Entities.getEntityProperties(foundEntity); if (isLocked(properties)) { - print("Model locked " + properties.id); + if (wantDebug) { + print("Model locked " + properties.id); + } } else { var halfDiagonal = Vec3.length(properties.dimensions) / 2.0; - print("Checking properties: " + properties.id + " " + " - Half Diagonal:" + halfDiagonal); + if (wantDebug) { + print("Checking properties: " + properties.id + " " + " - Half Diagonal:" + halfDiagonal); + } // P P - Model // /| A - Palm // / | d B - unit vector toward tip @@ -1000,8 +1005,9 @@ function mouseClickEvent(event) { } else { selectionManager.addEntity(foundEntity, true); } - - print("Model selected: " + foundEntity); + if (wantDebug) { + print("Model selected: " + foundEntity); + } selectionDisplay.select(selectedEntityID, event); if (Menu.isOptionChecked(MENU_AUTO_FOCUS_ON_SELECT)) { diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index 0308a092ed..3627a0a05e 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -2264,7 +2264,6 @@ SelectionDisplay = (function() { greatestDimension: 0.0, startingDistance: 0.0, startingAzimuth: 0.0, - lastVector: { x: 0, y: 0, z: 0 }, onBegin: function(event) { SelectionManager.saveProperties(); startPosition = SelectionManager.worldPosition; @@ -2337,7 +2336,6 @@ SelectionDisplay = (function() { var azimuth = translateXZTool.azimuth(pickRay.origin, pick); if ((translateXZTool.startingAzimuth > 0.0 && azimuth < MIN_AZIMUTH) || (translateXZTool.startingAzimuth < 0.0 && azimuth > MIN_AZIMUTH)) { - //vector = translateXZTool.lastVector; if (wantDebug) { print("Azimuth = " + azimuth); } @@ -2356,8 +2354,6 @@ SelectionDisplay = (function() { } } - translateXZTool.lastVector = vector; - // If shifted, constrain to one axis if (event.isShifted) { if (Math.abs(vector.x) > Math.abs(vector.z)) { @@ -3797,7 +3793,7 @@ SelectionDisplay = (function() { }; that.mousePressEvent = function(event) { - + var wantDebug = false; if (!event.isLeftButton) { // if another mouse button than left is pressed ignore it return false; @@ -3823,7 +3819,7 @@ SelectionDisplay = (function() { if (result.intersects) { - var wantDebug = false; + if (wantDebug) { print("something intersects... "); print(" result.overlayID:" + result.overlayID + "[" + overlayNames[result.overlayID] + "]"); @@ -3920,7 +3916,10 @@ SelectionDisplay = (function() { if (!somethingClicked) { - print("rotate handle case..."); + if (wantDebug) { + print("rotate handle case..."); + } + // After testing our stretch handles, then check out rotate handles Overlays.editOverlay(yawHandle, { @@ -3988,15 +3987,17 @@ SelectionDisplay = (function() { break; default: - print("mousePressEvent()...... " + overlayNames[result.overlayID]); + if (wantDebug) { + print("mousePressEvent()...... " + overlayNames[result.overlayID]); + } mode = "UNKNOWN"; break; } } - - print(" somethingClicked:" + somethingClicked); - print(" mode:" + mode); - + if (wantDebug) { + print(" somethingClicked:" + somethingClicked); + print(" mode:" + mode); + } if (somethingClicked) { @@ -4142,17 +4143,22 @@ SelectionDisplay = (function() { translateXZTool.pickPlanePosition = result.intersection; translateXZTool.greatestDimension = Math.max(Math.max(SelectionManager.worldDimensions.x, SelectionManager.worldDimensions.y), SelectionManager.worldDimensions.z); - print("longest dimension" + translateXZTool.greatestDimension); - translateXZTool.startingDistance = Vec3.distance(pickRay.origin, SelectionManager.position); - print("starting distance" + translateXZTool.startingDistance); - translateXZTool.startingAzimuth = translateXZTool.azimuth(pickRay.origin, translateXZTool.pickPlanePosition); - print("starting azimuth" + translateXZTool.startingAzimuth); + if (wantDebug) { + print("longest dimension: " + translateXZTool.greatestDimension); + translateXZTool.startingDistance = Vec3.distance(pickRay.origin, SelectionManager.position); + print("starting distance: " + translateXZTool.startingDistance); + translateXZTool.startingAzimuth = translateXZTool.azimuth(pickRay.origin, translateXZTool.pickPlanePosition); + print(" starting azimuth: " + translateXZTool.startingAzimuth); + } + mode = translateXZTool.mode; activeTool.onBegin(event); somethingClicked = true; break; default: - print("mousePressEvent()...... " + overlayNames[result.overlayID]); + if (wantDebug) { + print("mousePressEvent()...... " + overlayNames[result.overlayID]); + } mode = "UNKNOWN"; break; } From cee79c8274865f2dcd6653798832fe58fae8ae29 Mon Sep 17 00:00:00 2001 From: PhilipRosedale Date: Sun, 28 Feb 2016 15:44:23 -0800 Subject: [PATCH 5/8] Fixed bug in rayPlane test --- examples/edit.js | 5 +++-- examples/libraries/entitySelectionTool.js | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 54311a8c42..d39a20c2e3 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -728,9 +728,10 @@ function rayPlaneIntersection2(pickRay, point, normal) { // This version of the test returns false if the ray is directed away from the plane // var collides = Vec3.dot(pickRay.direction, normal); - if (collides > 0.0) return false; - var d = -Vec3.dot(point, normal); + if (((collides > 0.0) && (d > 0.0)) || ((collides < 0.0) && (d < 0.0))) { + return false; + } var t = -(Vec3.dot(pickRay.origin, normal) + d) / collides; return Vec3.sum(pickRay.origin, Vec3.multiply(pickRay.direction, t)); diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index 3627a0a05e..1834962e77 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -2334,10 +2334,13 @@ SelectionDisplay = (function() { // If the mouse is too close to the horizon of the pick plane, stop moving var MIN_AZIMUTH = 0.02; // Radians var azimuth = translateXZTool.azimuth(pickRay.origin, pick); + if (wantDebug) { + print("Start Azimuth: " + translateXZTool.startingAzimuth + ", Azimuth: " + azimuth); + } if ((translateXZTool.startingAzimuth > 0.0 && azimuth < MIN_AZIMUTH) || - (translateXZTool.startingAzimuth < 0.0 && azimuth > MIN_AZIMUTH)) { + (translateXZTool.startingAzimuth < 0.0 && azimuth > -MIN_AZIMUTH)) { if (wantDebug) { - print("Azimuth = " + azimuth); + print("too close to horizon!"); } return; } From 08eacc436f3d45251c5abb3a18728838e50be87a Mon Sep 17 00:00:00 2001 From: PhilipRosedale Date: Mon, 29 Feb 2016 10:13:01 -0800 Subject: [PATCH 6/8] Fixed rayPlane test again --- examples/edit.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index d39a20c2e3..59e1f74d20 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -729,12 +729,12 @@ function rayPlaneIntersection2(pickRay, point, normal) { // var collides = Vec3.dot(pickRay.direction, normal); var d = -Vec3.dot(point, normal); - if (((collides > 0.0) && (d > 0.0)) || ((collides < 0.0) && (d < 0.0))) { - return false; - } var t = -(Vec3.dot(pickRay.origin, normal) + d) / collides; - - return Vec3.sum(pickRay.origin, Vec3.multiply(pickRay.direction, t)); + if (t < 0.0) { + return false; + } else { + return Vec3.sum(pickRay.origin, Vec3.multiply(pickRay.direction, t)); + } } function findClickedEntity(event) { From d1bc31afb64f17001b4c38332c09943f511b50fb Mon Sep 17 00:00:00 2001 From: PhilipRosedale Date: Mon, 29 Feb 2016 10:16:34 -0800 Subject: [PATCH 7/8] azimuth function is really just a ratio --- examples/libraries/entitySelectionTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index 1834962e77..1be6030f6e 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -2332,7 +2332,7 @@ SelectionDisplay = (function() { var vector = Vec3.subtract(pick, initialXZPick); // If the mouse is too close to the horizon of the pick plane, stop moving - var MIN_AZIMUTH = 0.02; // Radians + var MIN_AZIMUTH = 0.02; // largest dimension of object divided by distance to it var azimuth = translateXZTool.azimuth(pickRay.origin, pick); if (wantDebug) { print("Start Azimuth: " + translateXZTool.startingAzimuth + ", Azimuth: " + azimuth); From 42f6ede43cee55399012a097abe585244b401e9c Mon Sep 17 00:00:00 2001 From: PhilipRosedale Date: Mon, 29 Feb 2016 10:22:24 -0800 Subject: [PATCH 8/8] azimuth = elevation, duh --- examples/libraries/entitySelectionTool.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index 1be6030f6e..95e695aa9c 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -2263,7 +2263,7 @@ SelectionDisplay = (function() { pickPlanePosition: { x: 0, y: 0, z: 0 }, greatestDimension: 0.0, startingDistance: 0.0, - startingAzimuth: 0.0, + startingElevation: 0.0, onBegin: function(event) { SelectionManager.saveProperties(); startPosition = SelectionManager.worldPosition; @@ -2307,7 +2307,7 @@ SelectionDisplay = (function() { visible: false }); }, - azimuth: function(origin, intersection) { + elevation: function(origin, intersection) { return (origin.y - intersection.y) / Vec3.distance(origin, intersection); }, onMove: function(event) { @@ -2332,13 +2332,13 @@ SelectionDisplay = (function() { var vector = Vec3.subtract(pick, initialXZPick); // If the mouse is too close to the horizon of the pick plane, stop moving - var MIN_AZIMUTH = 0.02; // largest dimension of object divided by distance to it - var azimuth = translateXZTool.azimuth(pickRay.origin, pick); + var MIN_ELEVATION = 0.02; // largest dimension of object divided by distance to it + var elevation = translateXZTool.elevation(pickRay.origin, pick); if (wantDebug) { - print("Start Azimuth: " + translateXZTool.startingAzimuth + ", Azimuth: " + azimuth); + print("Start Elevation: " + translateXZTool.startingElevation + ", elevation: " + elevation); } - if ((translateXZTool.startingAzimuth > 0.0 && azimuth < MIN_AZIMUTH) || - (translateXZTool.startingAzimuth < 0.0 && azimuth > -MIN_AZIMUTH)) { + if ((translateXZTool.startingElevation > 0.0 && elevation < MIN_ELEVATION) || + (translateXZTool.startingElevation < 0.0 && elevation > -MIN_ELEVATION)) { if (wantDebug) { print("too close to horizon!"); } @@ -4150,8 +4150,8 @@ SelectionDisplay = (function() { print("longest dimension: " + translateXZTool.greatestDimension); translateXZTool.startingDistance = Vec3.distance(pickRay.origin, SelectionManager.position); print("starting distance: " + translateXZTool.startingDistance); - translateXZTool.startingAzimuth = translateXZTool.azimuth(pickRay.origin, translateXZTool.pickPlanePosition); - print(" starting azimuth: " + translateXZTool.startingAzimuth); + translateXZTool.startingElevation = translateXZTool.elevation(pickRay.origin, translateXZTool.pickPlanePosition); + print(" starting elevation: " + translateXZTool.startingElevation); } mode = translateXZTool.mode;