POV-Ray : Newsgroups : povray.newusers : Moving Camera : Re: Moving Camera Server Time
28 Jul 2024 22:22:19 EDT (-0400)
  Re: Moving Camera  
From: Charles C
Date: 15 Jun 2007 19:25:02
Message: <web.46731eabe5525c43e94cc5130@news.povray.org>
"OpalPlanet" <ecs### [at] msncom> wrote:
> I'm new to POV, and I'm trying to make a camera follow a certain path. For a
> total time of 5, I want the camera to spend 0<t<1 at a certain point, then
> move along a specific circular path over time 1<t<2, and then remain at the
> end
> point of this path for t>2. This is the code i wrote for it, but it doesn't
> seem to work. I'm sure I'm missing someting stupidly obvious, but could
> someone give me a hand. Either de-bug or a pointer in the right direction
> would be helpful.
>
> Thx,
> OpalPlanet
>
>
> //declare variables for camera motion
> #declare loopcount = 0;
> #declare X = 0;
> #declare Y = 0;
> #declare Z = -3.5;
> #declare Ystep = -.01375;
> #declare Zstep = -.0125;
>
> #if (clock <= 1)
> camera {
>  location <0,0,-3.5 >
>  look_at <0,0,0>}
>
> #else #if (clock <= 2)
>  //move camera coords
>   #while loopcount <= 200
>    Y = Y + Ystep;
>    Z = Z + Zstep;
>   #end // end while
>  camera {
>   location <0, Y, Z >
>   look_at <0,0,0>
>   }
>
> #else
>  camera{
>   location<0,-2.75,-1>
>   look_at<0,0,0>
>   }
>  //end cameras


It looks like you're missing some parenthesis next to your #while statement,
and some #end statements. You also forgot to increment your counter.  It
doesn't work to use multiple #else's but there is a handier thing you can
use instead:

#switch()
  #case() #break
  #case() #break
  #case() #break
#end

Untested but it'd look something like this:


//declare variables for camera motion
#declare X = 0;
#declare Y = 0;
#declare Z = -3.5;
#declare Xstep = 0;
#declare Ystep = -2.75;
#declare Zstep = -1;


#declare MyClock = 5*clock; //A clock that goes from 0 to 1 is good for
compatibility.

#switch (MyClock)
    #case(MyClock <=1)
       #declare Cam_Location = <0,0,-3.5>;
       #declare Cam_Look_At  = <0,0,0>;
    #break
    #case(MyClock <= 2) //testing for <= 1 is covered by previous #case
       #declare Cam_Location =
<X+Xstep*(MyClock-1),Y+YStep*(MyClock-1),Z+Zstep*(MyClock-1)>;
       #declare Cam_Look_At  = <0,0,0>;
    #break
    #case(MyClock > 2)
       #declare Cam_Location = <0,-2.75,-1>;
       #declare Cam_Look_At  = <0,0,0>;
    #break
#end //end #switch (MyClock)

camera{
    location Cam_Location
    look_at  Cam_Look_At
}


Post a reply to this message

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