POV-Ray : Newsgroups : povray.animations : Camera Motion w/Splines and a #switch : Camera Motion w/Splines and a #switch Server Time
19 May 2024 20:50:07 EDT (-0400)
  Camera Motion w/Splines and a #switch  
From: OpalPlanet
Date: 26 Jul 2007 18:20:01
Message: <web.46a91cb6f79f43b31011e7330@news.povray.org>
Hi all -
I am making a "flythrough" of the solar system, and I've been having trouble
with my camera motion.
It works pretty well until #range(6, 6.5), when for some reason is snaps
back to the origin and spends that time staring at the inside of the sun.
I'm pretty sure I'm missing something stupid again, but I would appreciate
your help... I've included the #switch loop below

Thanks again,
OpalPlanet

//<xe, ye, ze> and <xj,yj, zj> are the current positions of Earth and
Jupiter, respectively. They are
//calculated earlier in the code.

#declare total_time = 10.0;
#declare my_time = clock*total_time;

#switch (my_time)

//Earth Camera
#range (0, .5)
camera{
 location<xe,ye, ze-.5>
 look_at <xe, ye, ze>
 right 1/1*x}
#break

//Inner system camera
#range (.5, 6)
#declare CameraSpline =
 spline {
   natural_spline
   .5, <xe, ye, ze-.5>
   2,<0,0,-4> // inner system
   3, <0,0,-10>//asteroids
   5, <0,3.5,.5>//in belt
//   7, <0,0,-20>
//   9,<0,0,-70>
    }

 #declare Look_atSpline =
  spline {
   natural_spline
  .5, <xe, ye, ze>
  .75,<0,0,0> // inner system
  // 5, <0,0,0>
       }

 camera {
 location CameraSpline(my_time)
// sky      -z
 right    1/1*x
 //rotate   <0,1e-5,0> // Prevent gap between adjecent quads
 look_at Look_atSpline(my_time)
}
#break

//from last point in spline, turn to see jupiter
#range(6, 6.5)
 #declare Look_atSpline2 =
  spline {
   natural_spline
 6, <0, 0, 0>
 6.5, <xj,yj,zj>
       }
#break

 camera {
 location < 0,3.5,.5 >
 sky      -z
 right    1/1*x
 //rotate   <0,1e-5,0> // Prevent gap between adjecent quads
 look_at Look_atSpline2(my_time)
}

//spline to jupiter

#range(6.5, 7)
#declare CameraSpline2 =
 spline {
   natural_spline
   6.5, <0,3.5,.5> //in belt
   7, <xj+1,yj+1,zj-2>//near jupiter
    }

 camera {
 location CameraSpline2(my_time)
// sky      -z
 right    1/1*x
 //rotate   <0,1e-5,0> // Prevent gap between adjecent quads
 look_at <xj,yj,zj>
}
#break

//follow jupiter
#range (7,8)
camera{
 location <xj+1,yj+1,zj-2>
 look_at <xj,yj,zj>
 right 1/1*x}
#break

//spline to far above system
#range(8,10)
#declare CameraSpline3 =
 spline {
   natural_spline
     8, <xj,yj,zj-2>//near jupiter
  10, <0, 0, -70>//way above system
    }

 camera {
 location CameraSpline3(my_time)
 right    1/1*x
// rotate   <0,1e-5,0> // Prevent gap between adjecent quads
 look_at 0
 }
#break
#end


Post a reply to this message

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