vector llGetLocalPos();
Forced delay: 0.0 seconds. Energy: 10.0.
Returns a vector that is the position relative (local) to the root.
If called from the root prim it returns the position in the region unless it is attached to which it returns the position relative to the attach point.
default
{
touch_start(integer vIntTouched)
{
string vStrMessage = "The touched prim is ";
if (llDetectedLinkNumber(0) > 1)
{
vStrMessage += (string)llVecMag(llGetLocalPos()) + "m from ";
}
llSay(0, vStrMessage + "the root prim");
}
}
There is no function to set the position of a prim local to itself. To set the position of a prim local to itself you would have to do something like:
SetPositionLocalToCurrentPosition(vector local_position)
{
llSetPos(llGetLocalPos() + (local_position * llGetLocalRot()));
}
Or:
SetPositionLocalToCurrentPosition(vector local_position)
{
llSetPos(llGetPos() + (local_position * llGetRot()));
}