Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

~Prim Children Gone Bad~

Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
11-03-2007 02:10
I made an example script to figure out how to move a single child prim to a new location.
CODE

default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}

touch_start(integer total_number)
{
llSetLinkPrimitiveParams(2,[PRIM_POSITION, <-.1,0,0>]);
llSleep(1);
llSetLinkPrimitiveParams(2,[PRIM_POSITION, <.1,0,0>]);
}
}

After setting the root prim, and the child prim to the perfect starting location (child over top of mother), I click and this is what happens.
The child moves DOWN and to the center of the root prim, THAN moves like the script wants it to. After that it moves how it's suppose to, except it;s not in the original place I put it, and never returns to were it was before the script ran.
Any ideas what went wrong int he script, and how to make it work the way I want it to?
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
11-03-2007 02:28
From: someone
llSetLinkPrimitiveParams(2,[PRIM_POSITION, <-.1,0,0>]);
llSleep(1);
llSetLinkPrimitiveParams(2,[PRIM_POSITION, <.1,0,0>]);


What it seems like you're doing wrong is thinking that the position you specify is relative to the child's current position. If you expect setting the position to <-.1, 0, 0> will move the prim -0.1 meters in total, regardless of its current position, that's where you're messing up. The position you want to set would be a destination position, relative to the root prim at <0, 0, 0>, and along the prim's local axes...
_____________________
Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
11-03-2007 02:34
so basically treat it like rezzing a prim, now to break out the calculator, and do some math ^-^