|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-09-2009 11:43
I recently created a HUD and distributed it among members of my group. For most people, the HUD appeared right where it was supposed to (I am using the Bottom attachment point but have used Edit to move the HUD physically toward the left side of the screen before I saved and distributed it). For a very small number of people, though, the HUD is apparently offset completely beyond the edge of the screen. In two cases, it also seems to be rotated 90 degrees, so that they are seeing it edge-on, instead of within the plane of the screen. With patient coaching, I can talk people through how to get the HUD where it belongs and properly rotated, but that's a nuisance for me and a frustration for them. Any clues about how I might script a way to do it automatically when the HUD is attached?
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
02-09-2009 11:47
llGetAttached llSetPos
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-09-2009 12:09
Um..... yeah, but that doesn't really deal with the problem. The HUD is attached at the correct attachment point, so llGetAttached is just going to confirm that. The problem is that not all screens are created equal, so the left edge of one person's screen isn't as far from the Bottom attachment point as the left edge of the next person's screen. What I really need is a way to detect where the left edge of the screen is, and then llSetPos relative to that. I have no clue why a few people have a HUD that's mysteriously rotated 90 degrees from the plane of the screen, but I could fix it by scripting llGetRot * some correction. Thing is .... What's the "correct" rotation for the plane of the screen, and what's the correction?
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
02-09-2009 12:31
take a cube... wear it on your hud. color the face you can see "green".
drop the cube. rotate it to <0,0,0>.
Build all your HUDs on the "green" (west btw) side of an unrotated prim. that's <0,0,0> rotation. Otherwise, your only other alternative is to llSetRot back to <0,0,0> or whatever. every time it's rezzed. (all hud anchors have the same rotation).
All screens may not be built alike, but all attachment points are. 0,0,0 of "upper left" is in the upper left corner of the screen. (+/- the menu). "Lower Left"'s <0,0,0> is in the lower left corner of the screen (+/- the menu/chatbars). A little experimentation will tell you "how much higher" or lower you need to be, to account for the menus.
Simple matter then of determining where your hud's <0,0,0> point should fall, in relation to a given HUD attachment point. it's usually a calculation like llSetPos(-1 * scale.z * .5, -1 * scale.x * .5) (no, that's not going to compile).
let's assume that a hud attaches to upper left. So, we need to move the hud half it's width to the right, and half it's height down.. so that it's top-left corner, falls at the 0,0,0 anchor point. Like I said though, you're going to end up having to account for the menu on top, and/or the various buttons/chatbar on the bottom.. so there will be a little voodoo there, and you're right, that's gonna be relative, so you'll just have to guess.
Then it's just a matter of determining if an attachment point is "new"... and that's not hard. if position now != last worn position, then it's a new position. You only want to "snap" to the defaults when the wearer changes to a new hud anchor point. That way you still allow them to attach to top, and drag to the bottom.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-09-2009 12:47
Fantastic! Those are just the puzzle pieces I needed. Thanks. 
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
02-09-2009 14:03
One other caveat to watch for thou is using llSetText to try to display text on buttons. The text will not be on the buttons on all resolutions. I went through this and finally just scrapped the idea and uploaded textures with the text already on it.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|