Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

consistent attachment positioning

Michael Jashan
Registered User
Join date: 25 Oct 2007
Posts: 7
06-01-2008 09:29
Hello everyone. Just let me say that this (these) forums are fantastic! I've learned so much from you all. I feel that if I were to see you in world, I could almost just start a conversation like we were old friends. Of course, you'd not have any idea to who you are speaking, but hey, I can dream right? :-D

Anyway, I've been struggling with attachment placement. I want to create a script that will place an attached prim at the exact center of an AV...no matter the attachement point.

I've tried many different methods, and maybe I'm just tired but it seems that I'm missing something in the big picture. I understand that there is some sort of "history" where the attachment remembers the position it was in at an attachment point (like if I put it on my LPec and then move it, it will always go to that offset when I re-attach) but I thought it is cleared when I reset the script inside. Somehow, it isn't consistent for me and it could be a source of my trouble.

So, my question(s): Via script, is there a way for me to automatically move the attachement (setpos or equivalent) to the center of the AV no matter what attachment point, and do I have to worry about / manage the attachment "history" if I move it when it is attached to me? Is it terribly different if the attachment is a linked set?

Thanks in advance for you support!
Renee Roundfield
Registered User
Join date: 10 Mar 2006
Posts: 278
06-01-2008 11:03
/15/58/145509/1.html
Michael Jashan
Registered User
Join date: 25 Oct 2007
Posts: 7
06-01-2008 11:32
Thank you! While this is helpful in understanding about attachment memory, I am still unsure how to get the script to automatically move the attachment to the center of an AV. I want to make this script so others can use the item and get it positioned in the center of their body no matter where they attach it. If I use this script, it will require a manual setup of all the attachment points for each user, right? I think I want to avoid that.
Michael Jashan
Registered User
Join date: 25 Oct 2007
Posts: 7
06-01-2008 11:36
I just re-read it. It looks as though I could set it all up for the user and just not reset the script. But that still leaves the question, how do I automatically discover the center of an AV? If I can understand that, maybe I can make this script work how I need it. :-)
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
06-03-2008 08:38
The problem here is that attachment points are linked to the avatar skeleton, the positioning of which is dependent on animations, which only run client side. For example, if you have an object attached to the left hand, that object will maintain it's position and orientation relative to the left hand's position and orientation (until/unless changed within the attachment via llSetPos, llSetRot and/or llSetPrmitiveParams). But exactly where that is at any given moment is only known client-side, and will vary from client to client depending on when each client received the animation.

Scripts only run server-side, so the most you can determine via script is what the current attachment point is and what the attachment's relative offset from that point is, but not where the attachment point or attachment actually are relative to the av.
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
06-03-2008 13:25
Right, Deanna.

Belly, Pelvis and Spine are the closest you're going to come, and even in this case you're subject to differences in shapes. The only way you could figure out the shape would be to play a "T" animation, have the avatar attach an object of yours in each of key joints, and have them report their positions to a master script that collects the information and does its best to make adjustments.

But Deanna's point is going to kill it anyway, and the further you get hierarchically from the hip the worse it's going to be. (The hip is the top of the hierarchy: everything stems off from it, and it's also generally closest to the center of the av.)