|
![](/i/fill.gif) |
On Wed, 15 Jan 2003 03:15:39 +0000, Phil Clute wrote:
> Why isn't this working?
> The correct behaviour should be an animation where the ship spins 360
> degrees(10 degrees per frame). Once it has completed 1 rotation it moves
> away from the camera and spins again.
> The ship spins just fine but I can't get it to move away from the camera.
>
>
>
> #declare NumColumns = 24;
> #declare Columns = 0;
> #declare NumRows = 36;
> #declare Rows = 0;
>
> #while(Columns < NumColumns)
> #while(Rows < NumRows)
> #declare T = Columns *40;
> object {ship rotate clock*z*360
> translate < 0, T, T> }
> #declare Rows = Rows + 1;
> #end
> #declare Columns = Columns + 1;
> #end
Rows has to be reinitialised to 0 inside the Columns loop.
The second time through the Columns loop Rows still has the value NumRows,
so the Rows loop will not be executed.
#declare NumColumns = 24;
#declare NumRows = 36;
#declare Columns = 0;
#while(Columns < NumColumns)
#declare Rows = 0;
#while(Rows < NumRows)
#declare T = Columns *40;
object {ship rotate clock*z*360
translate < 0, T, T> }
#declare Rows = Rows + 1;
#end
#declare Columns = Columns + 1;
#end
I believe that keeping the initialiser close to the #while loop makes it
clearer. I usually do it as
#declare N = 0; #while( N < Limit)
....
#declare N=N+1; #end
so that it looks more like a for() loop
Cheers,
PoD.
Post a reply to this message
|
![](/i/fill.gif) |