POV-Ray : Newsgroups : povray.animations : best to animate simple moving meshes : Re: best to animate simple moving meshes Server Time
26 Apr 2024 13:36:45 EDT (-0400)
  Re: best to animate simple moving meshes  
From: Christian Froeschlin
Date: 17 May 2012 10:13:03
Message: <4fb5076f$1@news.povray.org>
Christian Froeschlin wrote:

> #declare TRANSFORMS = array[42];

actually, since you have multiple objects you probably want
this to be something like

#declare TRANSFORMS = array[NUM_OBJ][NUM_TRANSFORMATIONS];

// Object 0
#declare TRANSFORMS[0][0] = transform {rotate 90*x translate 5*z};
#declare TRANSFORMS[0][1] = ...

// Object 1
#declare TRANSFORMS[1][0] = transform {rotate 40*x translate 5*z};
#declare TRANSFORMS[1][1] = ...

And in your shapes include file

#declare SHAPES = array[NUM_OBJ];

#declare SHAPES[0] = mesh {...}
#declare SHAPES[1] = mesh {...}
...

and use it as

#declare FRAME = <transformation index from "clock" or "frame_number">

#declare I = 0;

#while (I < NUM_OBJ)
   object
   {
     SHAPES[I]
     transform {TRANSFORMS[I][FRAME]}
   }
   #declare I = I + 1;
#end


Post a reply to this message

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