Jump to content

Global position of attached prim


Jenni Darkwatch
 Share

You are about to reply to a thread that has been inactive for 4762 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Oke, I _know_ this has been asked before but I can't find the answer anywhere. According to the wiki, llGetRootPosition() is the avi region position. llGetPos() is the avi region position if it's in the root of an attached object, and the prims' region position if called in a child prim. Except, that last part seems to be wrong or I'm misunderstanding the way it works.

If I create two boxes, link them together, and put the script below into the _child_ prim, the results never change even if i reposition the object on the avi:

 

default{
    touch_start(integer iNum) {
        llOwnerSay("Avi:"+(string)llGetRootPosition()+
                   " Pos:"+(string)llGetPos());
    }
}

 

If I edit the linked set and move it around... it doesn't change position (I moved it three times, no change):

 

[13:50] Object: Avi:<78.42548, 138.16290, 4052.70200> Pos:<78.62835, 138.37140, 4052.70200>
[13:50] Object: Avi:<78.42548, 138.16290, 4052.70200> Pos:<78.62835, 138.37140, 4052.70200>
[13:50] Object: Avi:<78.42548, 138.16290, 4052.70200> Pos:<78.62835, 138.37140, 4052.70200>

What am I missing?

Link to comment
Share on other sites

http://wiki.secondlife.com/wiki/LlGetPos

 

When called from the root of an attachment, returns the wearer's position.  But linking two boxes is not the same thing as attachment, which is the wearing of the prims on your avatar.

and if you are only moving the child prim via Edit Linked and not moving the base prim, you'll get this kind of answer.

 

Link to comment
Share on other sites

I guess I should have been more clear:

Of course I wear the linked object, and the results are when wearing it and moving the whole linkset around. I merely need a way to determine the position of a prim in a regional context - when that prim is attached to an avi. I'm aware of the issues with animation (it's clientside and the prim doesn't follow it) but that's not a problem.

The desired result is that I know _exactly_ where the prim is in region coordinates, so I can use it as destination for a moving object and/or rez something exactly at the prims location. Something like rezzing a bubble around a wearers head - move the attached object up/down to get a decent fit. There's other ways to solve this, attached prim would be the most logical for me.

Link to comment
Share on other sites

http://lslwiki.net/lslwiki/wakka.php?wakka=llGetPos

When used in the root of an object attached to an avatar it will always return the position of the avatar's center in region coordinates. When used in a child object in attachments, it will return the position of the child, in region coodinates, if the root was at avatar center and the root had zero rotation relative to this avatar center.  So if you have one prim attached to a bracelet, it'll report it's position as identical as the avatar's root position. 

You could try using llGetLocalPos() and adding the offset it reports to the base position of the avatar.  Then you have the exact position of the prim in regional coordinates.

 

Link to comment
Share on other sites

I tried the llGetLocalPos method too, but it doesn't seem to update either - in the end I went with plan B and just added a menu driven adjuster. It appears to me that it's either insanely hard to get a prim position for any attached prim, or entirely un-intuitive. Or I'm just too dumb to understand how it's supposed to work.

Thanks for the assistance anyway, Shockwave.

Link to comment
Share on other sites

Hi, the llGetPos information available for attachments really is that bad. On the root, yes it tells you the avatar's position. In a child, it tells you the region coordinates for that prim as if it was at ZERO_VECTOR and ZERO_ROTATION on the pelvis attachment point, and no animations were running. That is why you do not see any changes.

You really have to rely on llGetLocalPos and llGetLocalRot to get any useful information about where an attachment is. Because animation is a viewer effect, the result will still be only an approximation for the region position.

Adding -- this confusing condition is in the SL wiki now.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4762 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...