Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

animating attached objects

Mordred Lehane
Mechanical Alchemist
Join date: 13 Feb 2005
Posts: 109
12-19-2005 12:35
ive seen a few people wich avatars that have moving or animated parts, and have been working of a few avatars that require moving parts myself (turning gears, flapping wings, ect ect)

does anyone out there there know how i can make these objects move while they are attached to me? the rotation script i have ether dosent work when attached to other parts, or when attached to me.. im assuming there's a special script perhaps?
Kchark Maelstrom
Registered User
Join date: 9 Oct 2004
Posts: 5
12-25-2005 09:37
I'm interested in this as well...does anyone have any information on how to do this?
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
12-25-2005 13:48
I was just recently given a script that allows my tail to wag. It looks like it just applies a series of rotations to the linked set of prims (my fox tail) that it is placed in. All I had to do was to drop it into a copy of the tail, and it worked fine. Mind you, it's merely rotating the entire linked assembly of prims that make up my tail. An articulated motion would be much more difficult.

For flapping wings, I would expect you woulld need at least two scripts - a master script in one wing, and one that 'listens' to the other script for timing and flaps the second wing. Weather you could do that or not while they are linked to each other, I don't know. My guess would be the wings would need to be seperate attachments.

I'll go look at the script and try to parse what it does...
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
12-25-2005 14:16
Well, for what it's worth, here is the script that makes my tail wag:

vector start;
tailwag()
{
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <-20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*((RAD_TO_DEG*llRot2Euler(llGetLocalRot()))+ <20, 0, 0>;)));
llSetRot(llEuler2Rot(DEG_TO_RAD*(start)));
}
default
{
state_entry()
{
start = (RAD_TO_DEG*llRot2Euler(llGetLocalRot()));
llSetTimerEvent(10 + llFrand(10));
}
timer()
{
tailwag();
llSetTimerEvent(10 + llFrand(10));
}
}

It appears to be a script that gets the rotation vector of the prim it's in when the prim is rezzed, then applies some rotations to that vector value. I think you could probably get what you need from this.

Nimilia Strangelove gave me that script. I don't know if she wrote it or got it somewhere else. She didn't say.
Gabriel Sion
Registered User
Join date: 30 Aug 2005
Posts: 7
12-26-2005 05:11
Alternatively to that tail rotation script... Never made a tail myself so I wouldn't know how it really works, this is a way that I found works alright... If you manage to make it work right for you, of course.

You simply have to attach multiple objects that are invisible that would be the next "frame" of the object you are trying to animate. So if the wings would be folded and you want them to be unfolded, you would need to have the wings folded, and the wings unfolded which would be invisible, then a script would fire on whatever command you make and the folded wings would turn invisible and the unfolded would become visible...

As for gears and the like, I would imagine they would run on the Sleep command, meaning after a set amount of time one object would dissapear and the other one would pick up where it left off. Although that would require exact synchronism or you would have a complete circle instead of moving gears at all times.
Hope this helps.
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
12-26-2005 20:07
I've seen wings that fold and unfold that way. One set, invisible by default, that are spread wide, and one set, visible by default, that are mostly folded. A script allows the wearer to choose which set show.

One problem with that method, however, is that the wide-spread pair makes an unexpectedly wide area near the person wearing then where the invisible pair of wings can get clicked on by mistake. I accidentally gave items to several people when I had intended to rez the items near them, because the apparently clear area near them had an invisible wing in the way.
Torley Linden
Enlightenment!
Join date: 15 Sep 2004
Posts: 16,530
12-26-2005 20:11
Wynx Whiplash's ponies come with a really beautiful pair of wings that do flap when flying. I haven't taken that indepth a look but it appears like an animation is triggered via script, making the wings, attached to the proper points, simply flutter open and close.

On a most fundamental basis, you should be able to take the Rotation Script from the LIBRARY, put it in a plywood cube, attach it to any part of your avatar and watch it rotate. Does this not work for some?
_____________________