Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Static HUD attachment

Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
07-11-2007 18:00
Have been wanting to get this working for a while, but only just got around to it. This script will create a HUD attachment which will always move to the same on-screen position it left from, no matter what HUD attachment point it is/was attached to. Greatly helpful for clearing slot clashes. However. I haven't put this in the library because I suspect it depends on the aspect ratio of your SL window, which could mess it up a bit :( Does it work for people here?

From: Fix the darn bbcode!


list offsetsFromCenter = [<0,0,0>,<0,-0.66,0.5>,<0,0,0.5>,<0,0.66,0.5>,<0,0,0>,<0,0.66,-0.5>,<0,0,-0.5>,<0,-0.66,-0.5>];
vector knownNormalisedOffset = <0,0,0>;
integer lastAttachPoint = 31;

default
{

attach(key towho) {
if (towho != NULL_KEY) {
integer attachPoint = llGetAttached();
if (attachPoint == lastAttachPoint) return;
lastAttachPoint = attachPoint;
llSetPos(knownNormalisedOffset - llList2Vector(offsetsFromCenter,attachPoint-31));
} else {
knownNormalisedOffset = llGetLocalPos() + llList2Vector(offsetsFromCenter,lastAttachPoint-31);
}
}

}

Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
07-12-2007 12:52
I use 16:9 widescreen, I'll give it a try tonight and let you know.
_____________________
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
07-12-2007 12:57
Will this work for multi-prims huds? I'll give it a try when I get home.

BTW the bbcode workaround is posted here:

/327/b2/188445/1.html
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
07-13-2007 16:28
ok with 16:9 it doesn't work quite as intended. the offsets are wrong, since the horizontal distances are longer than 4:3. but I think you suspected that. confirmed.
_____________________
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
07-13-2007 21:21
From: Darien Caldwell
ok with 16:9 it doesn't work quite as intended. the offsets are wrong, since the horizontal distances are longer than 4:3. but I think you suspected that. confirmed.


Dangit. And short of asking the user, there's no way to detect the window's aspect ratio. :(