|
|
Mahalis wrote:
> How would I make wings on an object flap at a certain speed relative to the
> clock?
> ex:
> #declare flapSpeed=50;
> object{Wing rotate ???}
The simple solution goes something like this:
#declare min_angle = -45;
#declare max_angle = 45;
#declare center_angle = (min_angle + max_angle)/2;
#declare amplitude = abs(max_angle - center_angle);
#declare wing_angle = center_angle + cos(clock)*amplitude;
This would be a constant motion up and down, but most flapping requires a
shorter downstroke and a longer upstroke, so you can make a few adjustments:
#declare frac_clock = clock - int(clock); // The wave works between 0 and 1,
but not between 1 and 2
#declare wing_angle = center_angle + cos(pow(frac_clock,0.8))*amplitude;
This creates a slightly more realistic flapping motion. I recommend values
between 0.5 and 1. The closer to 1 you get, the smoother the flapping.
--
Josh English
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/
Post a reply to this message
|
|