diff --git a/scripts/system/pal.js b/scripts/system/pal.js index 20bd76f2ed..6af921155f 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -24,7 +24,7 @@ function ExtendedOverlay(key, type, properties, selected, hasSphere) { // A wrap overlays[key] = this; if (hasSphere) { var sphereKey = key + "-s"; - this.sphere = new ExtendedOverlay(sphereKey, "sphere", {drawInFront: true, solid: true, alpha: 0.6, color: color(selected)}, false, false); + this.sphere = new ExtendedOverlay(sphereKey, "sphere", {drawInFront: true, solid: true, alpha: 0.8, color: color(selected)}, false, false); } else { this.sphere = undefined; } @@ -263,15 +263,22 @@ function updateOverlays() { var avatar = AvatarList.getAvatar(id); var target = avatar.position; var distance = Vec3.distance(target, eye); + var offset = 0.2; + // base offset on 1/2 distance from hips to head if we can + var headIndex = avatar.getJointIndex("Head"); + if (headIndex > 0) { + offset = avatar.getAbsoluteJointTranslationInObjectFrame(headIndex).y / 2; + } + // get diff between target and eye (a vector pointing to the eye from avatar position) var diff = Vec3.subtract(target, eye); - // now, add a small bit of that difference to target - target = Vec3.sum(target, Vec3.multiply(Vec3.normalize(diff), 0.2)); - - // now bump it up a bit (TODO: scale this to the avatar height) - target.y = target.y + 0.2; + // move a bit in front, towards the camera (TODO: scale this based on height?) + target = Vec3.sum(target, Vec3.multiply(Vec3.normalize(diff), offset)); + + // now bump it up a bit + target.y = target.y + offset; overlay.ping = pingPong; overlay.editOverlay({