Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

HUD Movement

Smithy Zeno
ownes 9 pet cacti
Join date: 3 Aug 2006
Posts: 52
06-09-2008 14:05
Hey all,
I was wonder how to move an object in a HUD. I'm going to use this to make it so that I have a texture of a sim and it will give you your location, while an object on the HUD moves to the correct location on the scaled-down version on the HUD. If anyone could help me, that'd be great.
_____________________
-Smithy
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
06-09-2008 14:22
llSetPos works
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
06-09-2008 16:41
It sounds like you want to have the HUD be static, and just have a "pointer" prim which is a linked part of the HUD move. In that case, llSetLinkPrimitiveParams is your friend. (Or you could just have the child prim do llSetPos, either in response to link messages or by putting the script in it. It still needs to be a child prim though, or the whole HUD will move.)
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
06-09-2008 18:06
Something along the lines of my 3D radar in my sig link. You will have to have a center reference point and the postion of the object/avatar you want to display. Subtract the center vector from the display position and multiply by your scale.

Example:
CODE
vector centervector = <100,100,100>;
vector avatarvector = <150,150,150>;
vector displayvector;

default
{
state_entry()
{
displayvector = (centervector - avatarvector) * .005;//1/200th scale
llSay(0, (string)displayvector);//=<-0.25000, -0.25000, -0.25000>
}
}


HUDs only use the y and z coordinates but you need to display the x and y coordinates instead. So you will have to do something like this:
CODE
vector centervector = <100,100,100>;
vector avatarvector = <150,150,150>;
vector displayvector;

default
{
state_entry()
{
displayvector = (centervector - avatarvector) * .005;//1/200th scale
llSay(0, (string)displayvector);//=<-0.25000, -0.25000, -0.25000>
}
touch_start(integer total_number)
{
displayvector.z = displayvector.x;
displayvector.x = 0;
llSay(0, (string)displayvector);//=<0.00000, -0.25000, -0.25000>
llSetPos(displayvector);
}
}

Create a prim about .1 x .1 x .1 and attach it hud center and put this script in it. When you touch it you will see it move down and to the right.
_____________________
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
Smithy Zeno
ownes 9 pet cacti
Join date: 3 Aug 2006
Posts: 52
06-10-2008 11:52
Thanks Jesse :D
But one question, in your script how do I update the avatar's position?
_____________________
-Smithy
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
06-11-2008 01:32
From: Smithy Zeno
But one question, in your script how do I update the avatar's position?

With an attachment? You don't, not reliably.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
06-11-2008 04:24
From: Deanna Trollop
With an attachment? You don't, not reliably.

Sure you can, haven't done it personally but I have seen it in a targeting radar I bought a couple of years ago.

Principle would be the same as the 3D radar, turned on it's side with the x and z changes already illustrated. Probably one texture prim with rings for distance, and set back some from screen with an adjustment on the z axis so the child prim will show. And instead of rezzing prims, maybe 16 prim that stay at the zero point unless assigned a target by the main radar engine. Then each child prim will sense only it's target and update it's location per whatever the llSensorRepeat period is. When they loose thier target, they would return to the zero point instead of dying.

Sounds like a fun project!
_____________________
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
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
06-11-2008 08:06
I may have misinterpreted the question. I took "update the avatar's position" to mean "move the avatar." My apologies for the confusion.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
06-11-2008 16:57
From: Deanna Trollop
I may have misinterpreted the question. I took "update the avatar's position" to mean "move the avatar." My apologies for the confusion.

Hey I am the queen of that, just look at the disclaimer in my sig :D

Smithy: I was thinking about your script today at work and came to the conclusion that you would have to use llSetLinkPrimitiveParams as Yumi mentioned. You would still be able to scavenge the main part of my radar code but instead of assigning individual targets to the 16 child prims. Populate the main script list with strides of targets and positions. You could then use that list to make one long llSetLinkPrimitiveParams call.

Busy working a complicated Autoit script now in RL but when I finish (whenever that will be), I think I will give reworking mine into the same type of system, instead of having a max of 17 sensor scripts firing at the same time.
_____________________
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
Dumisani Ah
Pass me the hammer
Join date: 2 Dec 2006
Posts: 95
Slight deviation to topic..
06-12-2008 03:32
Jesse, I'm also tampering with your 3DRadar like Smithy is, but not in HUD format. I am trying a slightly different tack, which includes a sculpted map of 6 islands with four radar sensors per island, communicating back to the centrally placed sculpty map, the positions of the avs in sensor range of each, that then is translated into the positions of prim spheres on the map. Phew, that was a mouthful... Deep breath... And then a second set of data (same data actually, just represented differently) showing a 'You are here' sign to the person touching a 'INFO' or 'HELP' sign on the map. Very very basic idea still and only now getting the hang of your code in the standard map. I am just wondering if I could communicate with the sensors across such a vast distance or will I be better off to do one map per sim instead? Ok, so its way off topic :eek:

And where's Sneaky when you need him? :rolleyes:
_____________________
Screwdrivers are so 90's...