Creating HUDs

From Second Life Wiki
Revision as of 04:25, 1 December 2010 by Torley Linden (talk | contribs)
Jump to navigation Jump to search
Right-click an object in inventory and choose Attach to HUD > ... to use it as a HUD

In Second Life, objects can be attached to one of the eight HUD (short for head-up display) attachment points. Objects specifically designed to be used like that, might themselves be called "HUD". Other than objects attached to "normal" attachment points, those attached to HUD points will not show up on the Avatar's body, but instead on the user's screen. Only the user wearing them can see them, but chat emitted by them will be visible to other users and other objects.

Common Uses

HUDs are often used as informational displays (e.g. a sim radar, or a health-meter for inworld combat systems) or as control panels for Animation_Overrides, scripted attachments (e.g. recolorable prim clothes/shoes/hair, animated neko tail/ears) or other devices.

Scripting HUDs

Most scripted functionality works with HUDs, with the following exceptions. (The list is not exhaustive!)

  • Particles do not work. Don't have HUD prims generate them. If a HUD attempts to generate particles, they appear at <0,0,0> in the current sim, annoying your neighbors.
  • If a sound is triggered using llPlaySound(), only the HUD wearer will hear it. If the land parcel they're over restricts sound entry/exit, the sound will not play.
    • If a sound is triggered using llTriggerSound(), the wearer and any bystanders will hear it.
  • The Sensor will not detect the avatar wearing the HUD.

Scripted movement of HUD pieces is relative to the attachment points. The position vector used by llSetPos() is interpreted as [DESCRIPTION MISSING!]. A depth of -1 will render in front of a depth of 0.

Since HUD attachments cannot be clicked thru even if they're invisible, the common solutions to getting them out of the way are moving them and shrinking them.

If you are trying to move the HUD around relative to its current position, use llGetLocalPos() rather than llGetPos().

example:

<lsl>llSetPos(llGetLocalPos() + (<0.25,0,0> * llGetLocalRot()));</lsl>


Solving problems with HUDs

HUD is invisible

This problem arises when the person who made the HUD (or gave it to you) has a screen resolution greater than yours: The HUD is attached at the position that it had on their screen, but that is outside your field of view. The solution is:

  1. Attach another HUD (one that you know works properly for you).
  2. Right-click it and select "Edit".
  3. Zoom out until you can see the other HUD.
  4. Left-click on the stray and move it back within the white rectangle marking your viewer's screen size. Note: use the arrowheads to move the HUD, clicking on the arrows' tails sometimes drops you out of edit mode.
  5. Close the Edit window to return to normal viewing.

This will only bring the HUD back into view temporarily. Once you close the HUD and reopen it, the problem will repeat itself.


clean up!

In fighter aircraft and first-person shooters, the HUD (or Heads-Up Display) shows the user important information directly in their field of vision. In Second Life, HUD attachment points have been added to the right-click/pie menu and inventory right-click menu for objects you own. To attach an object to your HUD, right-click it, choose 'Attach HUD >' and pick one of the eight attachment points. The object will be attached to your viewer and only you will see it.

The biggest advantage to HUD attachment points is that they do not show up in-world as attached to your avatar. Other Residents will not see them. Many applications for this feature can be imagined, including games where you do not want the other players to see what you have; Informational displays such as speedometers, simulator statistics, radars, ammunition remaining, etc. and photo slideshows of your grandmother's visit to the largest ball of cling-wrap in the world. Subjecting others to that should be abuse-report-worthy. Keep them in your HUD!

HUD attachments can be scripted to take advantage of LSL, with a few limitations. Particles do not work on HUD attachments. In addition, there are a few known issues with HUD attachments. HUD attachments obscure chat bubbles if they overlap. HUD attachments can not be clicked-through because HUD attachments can receive touch events (by design). HUD attachments only appear in snapshots if you have the 'UI in snapshot' option enabled.