|
|
"RusHHouR" <gee### [at] mailnu> wrote in message
news:web.4459f5224a07a59a47d3ae5e0@news.povray.org...
> Hi!
>
> I'm making a simple animation with camera sweeping over the scene.
> As usual.
>
> But I wanna go further, and make a sign (see image link below) flap
> as if winds were blowing on it.
>
> http://img223.imageshack.us/img223/9836/taggtrad9rh.jpg
>
> Image shows "skylt" rotated at x-10
>
> object {skylt
> rotate <-10,0,0>
> translate <0.2,3.9,0>}
>
> How would one do to make it flap from rotate x 5 to x -10 continously
> through the animation?
> Can this be achieved?
>
> Thanks
>
> /RH
>
Hi R,
The following simplified example illustrates one way of getting something to
swing based on the clock variable.
This assumes a 5 second animation as the clock variable passes from 0 to 1
with a 2 second swing.
// Command Line settings +kfi0 +kff20 Use 320*240,No AA
camera {location <2,-0.5,0> look_at <0,-0.5,0> angle 50}
light_source {<30, 10, -300> color rgb 2}
#include "math.inc"
#declare MyClock = clock*5;
#declare SecondsPerCycle = 2; // One complete flap every 2 seconds
// Calculate a number that varies linearly between -1 and +1 over the cycle
#declare CyclePosition = mod(MyClock,SecondsPerCycle)*2-1;
// Apply a sine function to give a value that stays out at the extremes
longer
#declare CycleFactor = sind(90*CyclePosition);
cylinder {0,-y,0.05 pigment {color rgb <1,1,0>} rotate
x*(CycleFactor*7.5-2.5)}
Of course a sign wouldn't swing naturaly in wind, because the force varies
quite a bit as the sign moves, so you might want to add a bias so that it
stays longer at the far end of the swing than when it's down in the full
force of the wind. I assume you don't want to get into modelling the exact
behaviour.
Anyway, hope it gives you some ideas.
Regards,
Chris B.
Post a reply to this message
|
|