Monday, March 5, 2007

Sensors + HUD's: an SL radar

Despite 2+ months of messing with scripting, I've never written a script that used Sensors or tried my hand at HUD's (heads-up display). Yesterday, I decided to finally give it a shot.

I really like my MystiTool HUD, and it has a very helpful feature of showing all avatars within range, and the distance to them. But, it's still a bit of a hassle when you're trying to find someone, because it doesn't give the direction ( although there is a feature to send particles towards a target).

So, here's my first attempt at an avatar radar:



It basically scans within a specified range for all avatars and then displays their position on a radar-like HUD, in a top-down representation. The wearer of the HUD is in the center of the circle. Avatars that are straight ahead are at a 12 o'clock; behind are at 6 o'clock, etc. If the wearer rotates, the positions of all the target "blips" rotate around the HUD.

I thought it worked out pretty well for a first attempt!

There are a bunch of tweaks I'd like to implement:
  • take the text height information out of the blips, and change the blips to squares vs. upward and downward pointing triangles to represent targets that are at the same height, above, or below the user
  • re-scale the HUD. Right now, it's a "linear" scale, just like a normal map. Usually you are most interested in positions of avatars within 20 meters. If they are farther than that, relative position is good enough. So, I'd like most of the HUD area to be used for targets within 20 meters, and then the outermost rim of the HUD to be for all targets from 20 to 96 meters. This should decluster clumping of the avatars, and all the text info.
  • click on a blip to track ONLY that target (reduces sensor lag, and declutters the screen); click again and show all targets again
  • when tracking only a single target, display more information about them (perhaps the llRequestAgentData, but that could be a bit slow)
  • click the HUD to minimize it (get it out of the way), and again to maximize it
  • it'd be easy to add the option to scan for not just avatars, but physical / non-physical objects, scripted objects, etc.
  • add in a nifty submarine "ping-ping-PING" sound, as well as the option for sending griefer missiles at the targets (just kidding!)
It also amuses me when instead of wearing it as an HUD, it can be placed on the ground, and you can watch the little green blips moving around. Can anyone say "Mischief managed!" for a Harry Potter-esque Marauder's Map?

Kind of fun to work on something besides LoopRez for a bit!