Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Yes, it's the ever-popular attachment position question.

Fiona Branagh
... or her equivalent.
Join date: 1 Feb 2007
Posts: 156
05-16-2007 08:59
After doing quite a bit of reading, fiddling, and searching on this topic, I thought I'd ask it straight out:

Has anyone come up with a way to change the position of an attachment's child prim, reasonably relative to the position of the avatar as it moves about the sim? Or is this essentially impossible?

I'm considering several ways of working around it if using the center of the moving avatar is impossible, but it'd be very helpful to know if I'm reinventing the wheel (or reinventing a known broken wheel).

Note that I'm not asking if an object can follow the movements of an animated avatar, such as gestures. I know they can't. I'm just looking for something based upon the avatar's global position center, or the effective equivalent.

Thanks to all who respond!
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
05-16-2007 10:57
Use llGetRootPosition() to get the global position of the avatar the object is attached to. All attachments exist in "attachment space", which is its own coordinate system, relative to the avatar being at the origin, and specifically, the attachment point.
Fiona Branagh
... or her equivalent.
Join date: 1 Feb 2007
Posts: 156
05-16-2007 11:10
>>>Use llGetRootPosition() to get the global position of the avatar the object is attached to. All attachments exist in "attachment space", which is its own coordinate system, relative to the avatar being at the origin, and specifically, the attachment point.<<<

Oh yes, believe me, I do this already. I find the coords of the attached prims while they are attached, using the RootPosition.

It works flawlessly until my avatar turns, and then all of the rotations are borked.

I do know that rotations are a different case, and have dealt with the quaternions and such effectively for when the object is not attached. I can pick up the unattached object, rotate it, move it about via script or manually, and the repositioning/rotating works fine because I seem to understand quaternions and their uses well enough for that.

For some reason, attachments to the avatar do not work in the same way, even though I'm treating the center of the avatar as the root from which all of the same calculations are made.

Some people on these forums have said it's impossible to fix. Some people are struggling with finding an answer. It's possible some people have answers and won't tell due to proprietary selling needs.

I'm curious as to what the bottom line is :)
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
05-16-2007 13:24
Well, because attachments are defined in their own pseudo worldspace, and only interact with the world via the avatar, rotations are going to be weird, because some of the functions return real world-space coordinates and rotations, and others return attachment-space coordinates and rotations, some of which are badly bugged up.

Here's a good description of the "bottom line" when it comes to child rotations in attachments:

http://www.lslwiki.net/lslwiki/wakka.php?wakka=ChildRotation
Fiona Branagh
... or her equivalent.
Join date: 1 Feb 2007
Posts: 156
05-16-2007 13:32
Thanks, I appreciate the responses. I've definitely had some buggy issues with this so far.