Don't click here unless you want to be banned.

LSL Wiki : llGetLocalPos

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl814.us.archive.org
vector llGetLocalPos()

Gets the position of a child object in object-local coordinates, which are relative to the child's parent object.

If the script is inside the parent, or in an unlinked object, it will return the same value as llGetPos would.

ExampleGetRootPos shows an example of its use.

As of SL 1.7, llGetLocalPos will work with attachments, including HUD attachments. The value returned (in the root prim) is relative to the attachment point and not the position of the avatar. When used in the child of an object attached to an avatar, it will return the position of the child relative to the root in object-local coordinates

There is no llSetLocalPos() function; instead, llSetPos works fine.

To get the local rotation of a prim, use llGetLocalRot().


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Dynamics | Position | Link
Comments [Hide comments/form]
Not having a way to relate attachment local position to avatar position eliminates a wide range of interesting possiblities :-(
-- ReadyJack (2005-11-16 21:13:41)
what do you mean?
-- BlindWanderer (2005-11-17 14:51:57)
I mean at any given moment what is the vector from the attachment root prim position as given by llGetLocalPos to the location returned by a call to llGetPos within a script in the root prim of the attachment?
-- ReadyJack (2005-11-17 18:19:33)
On an attachment, as the root prim, llGetLocalPos is <0,0,0> where llGetPos is the region co-ordinates of the avatar.
-- JippenFaddoul (2005-11-27 22:37:49)
That's not quite correct Jippen. If you attach a cube and then edit it and move it while attached you will get a non-zero vector since llGetLocalPos in the root prim returns the offset from the point of attachment. For example, if you attach a cube to your skull and then move it to float above your head a meter you'll get a value similar to <0,0,1>.

My point is that there's no way for an attachment to know its 'global' position in the world. All it can know is the avatar's position. The information required is in the system somewhere since you can 'touch' other people's attachments. But I'm guessing that's client side functionality and that the animations (which determine where your arm might be at any given moment for example) are also client side and not synched to other clients so there's no objective true position for attachments at any given moment.

I can understand why it's like that but it's an unfortunate situation that really limits what can be done with av-to-av interactions like swordplay or anything similar.
-- ReadyJack (2005-12-04 21:48:59)
ReadyJack said "My point is that there's no way for an attachment to know its 'global' position in the world.".

There are times where you could get that location...

For example if the avatar is standing, his global would be llGetPos() + llGetLocalPos(). This doesnt account for when the avatar is in an animation that alters the location and/or rotation of the attachment point.
-- BirdRaven (2006-07-23 14:03:27)
Correct, it would be llGetPos() + ~half avatar size height + llGetLocalPos()... stupid instanctial reply.. Sorry ReadyJack lol. You can approximate heh :)
-- BirdRaven (2006-07-23 14:04:58)
Hahaha, yeah. That doesn't help me know if they guy swinging the broadsword is clipping my shield or my beard as I stab a spear through his eye ;-)
-- ReadyJack (2006-08-27 03:03:07)
Attach a comment to this page: