|
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
|
02-18-2008 12:57
Is it possible to attach an object via LSL that acts like "wear" from inventory does?
That is, can I have something remember where it was attached last, and just attach it there again? Or do I have to figure out/remember where it was last time in case something changed. Am I making any sense?
|
|
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
|
02-18-2008 13:23
When an object was attached using «attach to ...» the next time you can simply choose «wear» and it will end up at the same position as it was the first time...
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-18-2008 18:29
The llGetAttached() function returns the actual attach point if the object is attached. You could then use llAttachToAvatar() with the last remembered value. Also, the default attach point at this point in time is the right hand, so you could use ATTACH_RHAND as a default. No-script areas might prevent events from being triggered in a timely enough fashion to always capture this information, but that's something you could probably live with.
Remember that you need PERMISSION_ATTACH to attach programmatically (and that it only works when the object is in-world, not in inventory). The point at which you grab and remember the last attach position might be a great place to ask for this permission since the user doesn't get a dialog when the object is attached and asks for that permission. You'll still have to deal with changes of ownership or never-attached conditions though.
|
|
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
|
02-18-2008 19:15
Hewee: Thank you, wasn't thinking about the possibility of carrying the attach point in a variable when taken into inventory and back out. That ought to be fine.
|