Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Position of an attached Prim

Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
10-15-2008 09:08
I would like a script in a prim, attached to an avatar (say, at the right hand) to report to me the position of the attached prim.

llGetPos() is no good, as the wiki states: When used in an object attached to an avatar, it will always return the position of the avatar's center in region coordinates.

So, how do I get the centre of the attached prim, rather than the centre of the avatar?

llGetPrimitiveParams also reports position, but the wiki entry does not make it clear if it is restricted when attached, to the centre of the avatar, as in the llGetPos() function.

Any advice appreciated,

Rock
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
10-15-2008 09:16
This issue came up recently:

/54/a4/283331/1.html

I'm afraid the conclusion is that you can't get the position of an attached prim.
Xhawkx Holden
Registered User
Join date: 1 Nov 2006
Posts: 86
use llGetAttached()
10-15-2008 09:17
http://wiki.secondlife.com/wiki/LlGetAttached


Function: integer llGetAttached( );
224 Function ID
0.0 Delay
10.0 Energy

Returns an integer that is the attachment point the object is attached to or zero if not attached.


Constant Comment
ATTACH_CHEST 1 chest/sternum
ATTACH_HEAD 2 head
ATTACH_LSHOULDER 3 left shoulder
ATTACH_RSHOULDER 4 right shoulder
ATTACH_LHAND 5 left hand
ATTACH_RHAND 6 right hand
ATTACH_LFOOT 7 left foot
ATTACH_RFOOT 8 right foot
ATTACH_BACK 9 back
ATTACH_PELVIS 10 pelvis
ATTACH_MOUTH 11 mouth
ATTACH_CHIN 12 chin
ATTACH_LEAR 13 left ear

Constant Comment
ATTACH_REAR 14 right ear
ATTACH_LEYE 15 left eye
ATTACH_REYE 16 right eye
ATTACH_NOSE 17 nose
ATTACH_RUARM 18 right upper arm
ATTACH_RLARM 19 right lower arm
ATTACH_LUARM 20 left upper arm
ATTACH_LLARM 21 left lower arm
ATTACH_RHIP 22 right hip
ATTACH_RULEG 23 right upper leg
ATTACH_RLLEG 24 right lower leg
ATTACH_LHIP 25 left hip
ATTACH_LULEG 26 left upper leg

Constant Comment
ATTACH_LLLEG 27 left lower leg
ATTACH_BELLY 28 belly/stomach/tummy
ATTACH_RPEC 29 left pectoral
ATTACH_LPEC 30 right pectoral
ATTACH_HUD_CENTER_2 31 HUD Center 2
ATTACH_HUD_TOP_RIGHT 32 HUD Top Right
ATTACH_HUD_TOP_CENTER 33 HUD Top
ATTACH_HUD_TOP_LEFT 34 HUD Top Left
ATTACH_HUD_CENTER_1 35 HUD Center
ATTACH_HUD_BOTTOM_LEFT 36 HUD Bottom Left
ATTACH_HUD_BOTTOM 37 HUD Bottom
ATT
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
10-15-2008 09:56
Use llGetLocalPos on the root prim. It will return a position relative to the attachment point.

From: Pedro McMillan
This issue came up recently:

/54/a4/283331/1.html

I'm afraid the conclusion is that you can't get the position of an attached prim.


The conclusion there was that you couldn't tell exactly where in the sim the object was because of animation, but you most certainly can get the position relative to the attachment point.

Edit: Question of OP: Are you looking for region coordinates (where in the region the attached object is located) or coordinates relative to the attachment point (where on the attachment the object is located)?
Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
10-15-2008 16:31
From: Anya Ristow
Use llGetLocalPos on the root prim. It will return a position relative to the attachment point.



The conclusion there was that you couldn't tell exactly where in the sim the object was because of animation, but you most certainly can get the position relative to the attachment point.

Edit: Question of OP: Are you looking for region coordinates (where in the region the attached object is located) or coordinates relative to the attachment point (where on the attachment the object is located)?


I guess either. What I am trying to do is the reverse of MOCAP. I want to attach tiny prims to the 38 body positions, go through some animations sequences, gather the position data, then animate the prims to have a dancing robot made only of MOCAP lights. Only in the planning stage at the present, to see what is and is not possible.

Rock
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
10-15-2008 18:30
From: Rock Vacirca
What I am trying to do is the reverse of MOCAP. I want to attach tiny prims to the 38 body positions, go through some animations sequences, gather the position data, then animate the prims to have a dancing robot made only of MOCAP lights.


What you are looking for is the position of attached prims within the sim. You can't do that. The GetPos functions don't account for animations.