From 696169ed3731f93d95b104c862e34313d259e488 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Wed, 6 Jul 2016 15:19:10 -0700 Subject: [PATCH] terminate lines at intersection --- scripts/system/controllers/teleport.js | 33 +++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/scripts/system/controllers/teleport.js b/scripts/system/controllers/teleport.js index 4f0782da0c..caa898dd76 100644 --- a/scripts/system/controllers/teleport.js +++ b/scripts/system/controllers/teleport.js @@ -256,16 +256,15 @@ function Teleporter() { var location = Vec3.sum(rightPickRay.origin, Vec3.multiply(rightPickRay.direction, 500)); - this.rightLineOn(rightPickRay.origin, location, { - red: 7, - green: 36, - blue: 44 - }); var rightIntersection = Entities.findRayIntersection(teleporter.rightPickRay, true, [], [this.targetEntity]); if (rightIntersection.intersects) { - + this.rightLineOn(rightPickRay.origin, rightIntersection.intersection, { + red: 7, + green: 36, + blue: 44 + }); if (this.targetOverlay !== null) { this.updateTargetOverlay(rightIntersection); } else { @@ -273,6 +272,12 @@ function Teleporter() { } } else { + + this.rightLineOn(rightPickRay.origin, location, { + red: 7, + green: 36, + blue: 44 + }); this.deleteTargetOverlay(); } } @@ -300,16 +305,16 @@ function Teleporter() { var location = Vec3.sum(MyAvatar.position, Vec3.multiply(leftPickRay.direction, 500)); - this.leftLineOn(leftPickRay.origin, location, { - red: 7, - green: 36, - blue: 44 - }); var leftIntersection = Entities.findRayIntersection(teleporter.leftPickRay, true, [], [this.targetEntity]); if (leftIntersection.intersects) { + this.leftLineOn(leftPickRay.origin, leftIntersection.intersection, { + red: 7, + green: 36, + blue: 44 + }); if (this.targetOverlay !== null) { this.updateTargetOverlay(leftIntersection); } else { @@ -318,6 +323,12 @@ function Teleporter() { } else { + + this.leftLineOn(leftPickRay.origin, location, { + red: 7, + green: 36, + blue: 44 + }); this.deleteTargetOverlay(); } };