POV-Ray : Newsgroups : povray.animations : Tracking animation 'state' : Re: Tracking animation 'state' Server Time
27 Sep 2024 18:16:17 EDT (-0400)
  Re: Tracking animation 'state'  
From: apollofencer22
Date: 22 Jul 2004 22:35:00
Message: <web.410078f973091c272c1235ad0@news.povray.org>
Ross Del Duca <ros### [at] delducagroupnet> wrote:
> I've created a model of flapping wings.  There are ribs, with bicubic
> patches forming the 'skin' between the wings.  The wings are generated with
> a macro that takes "spread" and "flap" values to determine their position -
> which can in turn be based on the clock.
>
> What I'm trying to add now is a way to have the 'skin' stretch as if
> experiencing wind resistance.  To do that - I need someway to know the
> motion of the wing (i.e. up or down) but I'm stumped about how to do this
> since each frame is rendered individually.  Is there an easy way for me to
> track what the last frame rendered was, so that I can then determine which
> way to stretch the bicubic patch?
>
> Thanks all!

Hey Ross-
Create a text file in the same folder as your .pov.
Use the #fopen statement with #read to get the value in the text file, and
with a #if statement check the previous wing position, then do with it what
you need to. Then at the end of your code #fopen and #write the new value
you want for the next frame.
example: (right in povray)
#declare wing_position = 0;
 #fopen MyFile1 "wings.txt" read
  #read (MyFile1, wing_position)
 #fclose MyFile1

 #if (wing_position = 1) // open
   // do something
   #declare next_position = 0;
 #else // closed
   // do something else
   #declare next_position = 1;
 #end

// povray code

#fopen MyFile1 "wings.txt" write
  #write (MyFile1, next_position)
 #fclose MyFile1
// this will make every other frame have an "open" or "closed" value


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.