Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Flapping wing script - help needed

Nekokami Dragonfly
猫神
Join date: 29 Aug 2004
Posts: 638
01-14-2005 19:29
Hi,

I'm trying to make a parrot that will occasionally take off, fly around, and return to my shoulder (or wherever I put its target item). I'm not interested in buying it, I want to build it myself. However, I'm stuck. I just can't figure out how to script the wing flapping motion.

Yes, I searched through this forum and checked the wiki llSetLocalRot and related pages, and I'm sorry, I still can't figure it out. I'm getting parent/child mixed up, or not using the right function(s), or something (if I knew where my point of confusion was, I probably could figure out how to get un-confused, eventually). It's embarrassing, because I do write code in RL in a couple of languages, and I've written a few scripts involving particles and animations in LSL that have worked fine, so I rather think I ought to be able to work this out on my own, but my attempts at code so far are too embarrassing to post. I also suspect I haven't constructed the object correctly. Is anyone willing to give or sell me a sample of one object attached to another, that flaps like a wing? (Or post a snippet here and tell me how to build the object, which might help more readers....) It needn't be pretty (the object, I mean), I just need some kind of example to look at to figure this out.

I'll commit to writing a tutorial about it on the wiki, once I know how, if that is any encouragement to anyone to help....

Thanks,

Neko
Upshaw Underhill
Techno-Hobbit
Join date: 13 Mar 2003
Posts: 293
01-14-2005 21:43
One method for both launching the bird and flapping the wings would be llSetAlpha or llSetLinkAlpha.

The object on your shoulder can be made invisible by setting all prims to alpha of 0.0 and the rez the flying version which has 2 or 3 wing positions which are then alpha-ed in and out in sequence to make it appear to be flapping.

I'm no math whiz so this rather than the rotations hell you're actually looking for would be my simpler suggestion.

There is a kind of llSetLocalRot primer though if you want, in Aaron Perkins open source car script. Use the Front Wheel script for your wings and just keep telling them that you're turning right then left over and over :)

Find it Here

L8r,
UU
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
01-14-2005 23:13
I use the llSetAlpha method with link messages to flap the wings on my butterflies. Because of the way the wings are set up, each position is represented by a single prim, so the wings are always coordinated.
_____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'
Nekokami Dragonfly
猫神
Join date: 29 Aug 2004
Posts: 638
01-15-2005 11:00
Silly me, I was thinking too literally, I guess... I'll try both the car tutorial and the alpha method, to see which I like better. I had thought I was going to need to mess around with rotating everything to have the parrot switch between perch and fly positions, but the alpha method would definitely make more sense in that case. Though it will use up more prims. I'm always on the lookout for ways to save prims -- I'm on a pretty strict budget. (I guess that won't matter quite so much with an attachment.)

I have a nice crow from the Fairchangs (I think) that I like the appearance of. I'll have to look at it more closely to see if it's really rotating wings, or just using the alpha trick. (I also have a clever hummingbird that uses a translucent arc to suggest rapid wing movement, but I think that's not what I'm looking for in this project.)

Thanks for all the help!

Neko
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
01-15-2005 22:42
If it's the one I think it is, it uses rotating wings. You can tell because the wings occasionally get out of sync.
_____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'