Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

linked prim movement

Billy Fieschi
Registered User
Join date: 21 Jul 2006
Posts: 9
03-22-2008 02:30
Ok, I have only recently started scripting so be gentle.

I have a linked prim set containing 4 buttons and a cube, I have set each button to move the cube in each of four directions, the cube moves using llsetpos and llgetpos commands.

the problem i have is that all the buttons move as well as the block, how can i move the block and leave the buttons in the same place,

thanks :)
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-22-2008 04:03
the block needs to be a prim that is not the root for it to move independantly. you could make one of your buttons the root, and address the cube using llSetLinkPrimitiveParams
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Sekker Thirroul
Registered User
Join date: 27 Aug 2006
Posts: 28
03-22-2008 05:19
if the cube is a linked child setpos will move it relative to the root rather than relative to the sim coordinates. So its a good idea to have the root prim in roughly the center of the range of movement of your cube.
probably not that useful for your application but you can also make a simple script that says the offset/local rot but thats more handy if your recording a set of positions and movement.
Billy Fieschi
Registered User
Join date: 21 Jul 2006
Posts: 9
03-22-2008 14:50
Ok, thanks, doesn't do anything when I change the root prim.

i have the following in the cube -

CODE

vector pos=<0,0,0>;

default
{
link_message(integer Sender, integer Number, string Text, key ID)
{
if(Text == "UP")
{
pos=llGetPos();
llSetPos(pos+<0,0,0.1>);
}
else if (Text == "DOWN")
{
pos=llGetPos();
llSetPos(pos+<0,0,-0.1>);
}
else if (Text == "LEFT")
{
pos=llGetPos();
llSetPos(pos+<0,0.1,0>);
}
else if (Text == "RIGHT")
{
pos=llGetPos();
llSetPos(pos+<0,-0.1,0>);
}
}
}


And the following in the buttons -

CODE

default
{

touch_start(integer touched)
{

llMessageLinked(LINK_ROOT, 0, "UP", llDetectedKey(0));

}
}


Can you see what I need to change or add?

Thanks, your help is much appreciated.
Billy Fieschi
Registered User
Join date: 21 Jul 2006
Posts: 9
03-25-2008 07:40
Soooo! have I done that wrong then?
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
03-25-2008 11:47
Change LINK_ROOT to the link number of the box, or LINK_SET, or LINK_OTHER, or something. Right now the link messages are going to the root prim, and the box is no longer the root prim, right? :-)