Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Detecting the global position of an attachment

Kafka Potato
Registered User
Join date: 23 Mar 2006
Posts: 17
03-30-2006 08:23
I'm trying to make a "trails" effect

I'm trying to create a trippy trails effect, and it kinda hinges on detecting in some fashion, the absolute position of an attached object.

Problem -
llGetPos, and getRootPosition only give me the avatar's location.
llGetLocalPos is the offset from the attatchment point =0,0,0
sensors can't detect attached object according to the wiki.

Is there any way to get this info?

I've tried searching the wiki, and I just can't find it.
Feynt Mistral
Registered User
Join date: 24 Sep 2005
Posts: 551
03-30-2006 10:29
vector globalAttachmentPos = llGetLocalPos() * llGetRot() + llGetPos();

Or at least, I believe that's correct.
_____________________
I dream of a better tomorrow in SL!
You should too. Visit, vote, voice opinions.
Support CSG! Tell LL how much it would mean to subtract one prim from another!
Prim Animation! Stop by and say something about it, show your support!
Kayla Stonecutter
Scripting Oncalupen
Join date: 9 Sep 2005
Posts: 224
03-30-2006 11:07
From: Feynt Mistral
vector globalAttachmentPos = llGetLocalPos() * llGetRot() + llGetPos();

Or at least, I believe that's correct.
Unfortunately, you can't get the exact global position of an attachment. llGetPos() give the center of the avatar and llGetLocalPos() gives the offset from the attachment point, not the avatar center. There is no way to tell where the attachment point is relative to the center point, since animations are client side effects. Lets say the attachment is on the hand: it doesn't matter if the anim has the hands down by the side, or above your head, the result from the above would be the same.

Not sure what your going for, Kafka, but have you tried llParticleSystem() with PSYS_SRC_PATTERN_DROP? Or maybe PSYS_SRC_TARGET_KEY to send them directly to the attachment, provided you can get the UUID?
_____________________
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-30-2006 11:33
From: Kafka Potato
I'm trying to make a "trails" effect

I'm trying to create a trippy trails effect, and it kinda hinges on detecting in some fashion, the absolute position of an attached object.
That's not possible. An object has no attached position that is known in world... the attachment's position is only known to the client and may be different in every client.

You need to use a client-only mechanism like llParticleSystem() to get the effect you're looking for.
Kafka Potato
Registered User
Join date: 23 Mar 2006
Posts: 17
too bad
03-30-2006 11:44
I had kinda thought that might be the case.
as noted llGetLocalPos is basically useless for attached items (at least in this context)

I am playing with particles to accomplish the same thing - god I hate tweaking textures - is there anyway to tweak the sprite shape for a particle? or is basically oval and shaped have to be done via tranparent texture tricks? all I need is a small cylinder - gah.

Ok, stop complaining and start Gimping I suppose
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-30-2006 13:37
Particles have no "shape". They are two-dimensional objects in the plane of the screen.