Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Is llSetPos BROKEN !?!?!?

WarKirby Magojiro
Registered User
Join date: 24 Oct 2006
Posts: 49
02-11-2007 02:39
I can;t make llSetPos work in child prims. It does nothing. The following script fails

default
{
touch_start(integer total_number)
{
llSetPos (,x,y,z);
}
}

Where XYZ are coordinates fairly close to the child prim (within 10m). Also..

llSetPos(variablename);

seems to fail. But

llSetPos(llGetLocalPos() + <0,0,1>;);

Seems to work fine.

This is giving me problems with this particualr script....
--------------------------------------------------------------------------------------------------------
float targetdonations = 1000.0;
float currentdonations;
float percentagefilled;
float fillerlength;
integer i;

default
{
link_message(integer sender_num, integer num, string str, key id){
currentdonations = (float)num;
percentagefilled = ((currentdonations/targetdonations)*100);
fillerlength = (percentagefilled*0.1);
llSay (0,"current position "+(string)llGetPos());
vector newpos = (llGetRootPosition() + <0,0,fillerlength/2>;);
llSay (0,"new position "+(string)newpos);
llSetScale(<0.5, 0.5, fillerlength>;);
llSetPos(newpos);
}
}
--------------------------------------------------------------------------------------------------------Through the Debug messages, I have confirmed that all the calculations work perfectly. But the prim does NOT move to the new location when llSetPos is called. Even though the location is definately NOT it's current one.

This is driving me crazy. Is there a bug at work here, or am i doing something wrong?

WarKirby
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
02-11-2007 02:45
Looks like you're doing everything in global coordinates, but when you call llSetPos in a child prim it's expecting local (that is, relative to the root prim) coordinates.
_____________________
Solar Ixtab
Seawolf Marine
Join date: 30 Dec 2004
Posts: 94
02-11-2007 02:52
From the documentation on llSetPos:

From: someone
Moves the object to position pos. If the calling script resides in a single prim or the root of a linked object, then pos is in region coordinates, which are relative to the simulator's southwest corner. If the script resides in a child prim in a link set, the pos is relative to the root prim of the link set.


The correct way to go about this is to perform llGetPos on the root prim, and then calculate an offset from the global coords you want to move the child prim to.
_____________________
Despite our best efforts, something unexpected has gone wrong.
Grantly Hamilton
Registered User
Join date: 31 Mar 2004
Posts: 38
03-15-2007 01:41
I am having this problem also... it used to work fine... but now it seems that defined variables are not working inside child prims for llSetPos() & llSetScale(), and who knows what else...

As you stated, in child prims... llSetPos(llGetLocalPosition() + (vector variable)) IS NOT WORKING...

...but llSetPos(llGetLocalPosition() + <0.5,0.5,0.5>;)) IS WORKING...

EDIT: Actually, it does work... I was incorporating my llGetRootPosition Wrong... The way I'm doing it may be flawed... Give me a few :) Got to see what's up with my scaling also.

Ok, I tested on a seperate object. It works, I must not be translating a vector properly somehow(which I cannot find for some reason on my project:/)...

Good luck.