Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rotation and position for attached objects

TwoSheds Flanagan
Registered User
Join date: 20 Jun 2007
Posts: 13
01-06-2008 11:37
So far every time I've started to post a question on a problem I've been wrestling with I've subsequently come up with the answer, so I'm hoping that the same happens now...

Nertz.

I'll try to explain what I want to do. I've got a HUD with a several buttons. Some are designed to rez and attach an object in the HUDs contents to the avatar's right hand and some to it's left. They also play a specific animation. All of this works great.

My problem is that, depending upon the animation being played, the object needs to be in varying positions and rotations relative to the attachment point on the avatar. Clearly llGetLocalPos, llGetLocalRot, llSetPos and llSetLocalRot are what I'm looking for, but apparently I was absent the day/week/year/decade they covered this in geometry. I miss degrees.

I suppose I could have a variety of objects in the HUDs contents folder, each pre-adjusted to the appropriate position and rotation for that animation, and res and attach a different object for each animation, but that seems to lack elegance. I'd much rather have a script do it for me.

In theory I assume I'd want to get the position and rotation of the object when it attachs to the avatar, then modify them, and then set them (hopefully quickly enough that the avatar doesn't look too spastic).

The trouble is that in practice I have no earthly idea how to manage that. Is there a "LSL Rotation and Positioning for People who would have to attend years of intensive round the clock education in order to be called Dummies" sort of thing out there somewhere and if so can someone point me in that direction, preferably NOT using radians or euler math?

Thanks for any help.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-06-2008 11:58
not sure of the specifics of how you're managing detection of the av's currently playing animation, but there is a free open source 'attachment set' that alows you to edit and set different offset postions for an attachment based on the av's curent animation playing.

you can find it @ Caveat Emporium in Endless Destruction (search inworld places) located in a striped box, outside the front door on a cart...

essentially it operates like an Animation Overider, detecting the current playing animation, and stores a set of postions related to that animation... all done by chat command, but you could pick the code apart to get what you need.

my suggestion would be to have one script in the hud detectiting your current animation, and have it send messages on the currently playing animation to any attachments, and then each attachment parses for it's own specific animations/positions... or something of the kind
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -