From 3241ea7c1f3ec4973ba746dedd3cafa2ebe6e11b Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sun, 18 Oct 2020 22:59:08 -0400 Subject: [PATCH] Add support for teleportToEntity Add support for teleportToEntity --- .../create/entitySelectionTool/entitySelectionTool.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/system/create/entitySelectionTool/entitySelectionTool.js b/scripts/system/create/entitySelectionTool/entitySelectionTool.js index 0250ead0a9..b218d8b986 100644 --- a/scripts/system/create/entitySelectionTool/entitySelectionTool.js +++ b/scripts/system/create/entitySelectionTool/entitySelectionTool.js @@ -636,6 +636,16 @@ SelectionManager = (function() { } }; + that.teleportToEntity = function() { + if (SelectionManager.hasSelection()) { + var distanceFromTarget = 3 + Math.max(Math.max(SelectionManager.worldDimensions.x, SelectionManager.worldDimensions.y), SelectionManager.worldDimensions.z); + var teleportTargetPosition = Vec3.sum(SelectionManager.worldPosition, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: distanceFromTarget })); + MyAvatar.goToLocation(teleportTargetPosition, false); + } else { + audioFeedback.rejection(); + } + }; + return that; })();