From 7101a37bf983e890b772adee24c357c25b28c522 Mon Sep 17 00:00:00 2001
From: Triplelexx <void>
Date: Fri, 16 Mar 2018 20:27:05 +0000
Subject: [PATCH] add inspect avatars

---
 script-archive/inspect.js | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/script-archive/inspect.js b/script-archive/inspect.js
index 45fc281792..18b26ab709 100644
--- a/script-archive/inspect.js
+++ b/script-archive/inspect.js
@@ -56,7 +56,6 @@ var mode = noMode;
 var mouseLastX = 0;
 var mouseLastY = 0;
 
-
 var center = {
     x: 0,
     y: 0,
@@ -259,16 +258,16 @@ function mousePressEvent(event) {
         // Compute trajectories related values
         var pickRay = Camera.computePickRay(mouseLastX, mouseLastY);
         var modelIntersection = Entities.findRayIntersection(pickRay, true);
+        var avatarIntersection = AvatarList.findRayIntersection(pickRay);
 
         position = Camera.getPosition();
 
-        var distance = -1;
-        var string = "";
-
-        if (modelIntersection.intersects && modelIntersection.accurate) {
-            distance = modelIntersection.distance;
-            center = modelIntersection.intersection;
-            string = "Inspecting model";
+        if (avatarIntersection.intersects || (modelIntersection.intersects && modelIntersection.accurate)) {
+            if (avatarIntersection.intersects) {
+                center = avatarIntersection.intersection;
+            } else {
+                center = modelIntersection.intersection;
+            }
             // We've selected our target, now orbit towards it automatically
             rotatingTowardsTarget = true;
             // calculate our target cam rotation
@@ -284,7 +283,6 @@ function mousePressEvent(event) {
 
             isActive = true;
         }
-
     }
 }