Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

taking off a hat

Brendan Etzel
Registered User
Join date: 22 Jul 2007
Posts: 33
11-23-2009 23:54
I made an animation to take off a hat.

The hat needs to attach to the hand when the hand reaches the hat.
It needs to be put back after the greeting.

I have two problems: One is the timing, how can I trigger the attachment when the hand reaches the hat?
The other is that llAttachToAvatar needs permission, can that be done without the dialog ?
Can anyone explain how I could make this work ?

Thanks, Brendan
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
11-24-2009 00:06
The toughest part of llAttachToAvatar is that the object needs to be rezzed in world before it does much. It doesn't provide for switching attachment points for an already worn object, I'm afraid.

To get the effect you want, it might work better to have two hats, one on the head and one in hand, and flip-flop llSetAlpha on the two after playing raise and lower animations. Aligning the attachments so it looks right will simply add to the fun of it all ;)
Lennard Denver
Registered User
Join date: 20 Jun 2009
Posts: 9
11-24-2009 00:07
Make it 2 animations. The first is the hand going to the hat. Attach the hat to the hand and start the second animation etc.....
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
11-24-2009 04:05
Hmmm... Maybe a sheath type of scripting wouldn't be a bad idea...

You have 2 hats: an invisible one attached to hand, a visible one on head.

The hat in hand plays the anim that brings the hand to the hat, waits until completion, sends a chat message to hat on head and becomes visible. (Animation will have to be precise so that the 2 hats overlap.)

The hat on head becomes invisible and plays the anim to "take the hat off".

The chat delay and the fact that each hat plays one animation provides all the needed synchronization.

Since this is a hat and not a sword in sheath, switching visibility is easy:

llSetLinkAlpha(LINK_SET, isVisible, ALL_SIDES);

Putting the hat back on head is the same: Anim, switch visibility, anim to bring the hand away so that SL doesn't slam your arm back into whatever position it sees fit.
Coldfire Nightfire
Registered User
Join date: 25 May 2008
Posts: 48
Kaluura Boa that Idea rocks
11-24-2009 07:05
Thank you so much I am - Was having the same prob , and that would be the easyest fix for it . Dam thanks again :} So many smart people on here .
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-24-2009 07:50
you can also shrink/expand/move the two alternatively so that the invisible parts aren't in the way/clickable
_____________________
|
| . "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...
| -
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
11-24-2009 12:09
From: Void Singer
you can also shrink/expand/move the two alternatively so that the invisible parts aren't in the way/clickable

and shrinking and tucking away instead of setting alpha to 0 is better on render cost
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-24-2009 17:55
not so much the alpha (if you're going to mess with textures they are still renedered then ignored with alpha, so swapping with plywood is better there, but probably not worth the effort)
_____________________
|
| . "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...
| -
Brendan Etzel
Registered User
Join date: 22 Jul 2007
Posts: 33
11-25-2009 12:00
Got some really cool ideas to play with now, thanks a bunch
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
11-25-2009 19:52
to make sure the timing is correct between animations and hats changing between visible/invisible, i would probably use a gesture with chat commands telling the hats when it's worn or not worn because the gesture a built in wait, it can wait as many seconds as you tell it, or until the animation(s) are done
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369