POV-Ray : Newsgroups : povray.general : Animation Error : Re: Animation Error Server Time
29 Jul 2024 12:20:12 EDT (-0400)
  Re: Animation Error  
From: Alain
Date: 26 Aug 2011 19:34:26
Message: <4e582d82$1@news.povray.org>

> Hello,
>
> I have a problem by Povray,  I am very new by Povray area
> Maybe you can help me, It will be very nice.
>
> My problem is as following,
>
> I established a vehicle, which I would like on 8 form platform once racing in
> Povray.
> I used for it, the Spline_Trans macro  from See Johansen.
>
> My problem is, the vehicle does not tracking the path
> That I already defined
>

>
> The following is mine povray code
> Could you tell me please where did I made mistake?
> -----

> #include "colors.inc"                 // Defintion der Farben

> #include "math.inc"
> #include "transforms.inc"
> background {color rgb<1,1,1>}
>
>
>
> camera
> {
> location<  0, 8, -20.0>
> look_at<0, -0.8, 0>
> angle 12
> }
>
> light_source {<  -30, 30, 0>  color White }
>
>
> //definition der Bahn
> cylinder {
>    <0,-1.1,0>,<0,-1,0>,  2.1
> texture { pigment { color Grey } }
> }
>
>
> cylinder
> {
> <0,-1.3,0>,<0,-1,0>,  0.77
> texture { pigment { color Green }
>          }
> }
>
>
> cylinder {
>    <0,-1.1,2.6>,<0,-1,2.6>,  2.1
> texture { pigment { color Grey } }
> }
>
> cylinder
> {
> <0,-1.3,2.6>,<0,-1,2.6>,  0.77
> texture { pigment { color Green }
>          }
> }
>
>
> #declare FahrzeugKoerper=
>
> box{<-0.3, -0.95, 1.0>,<0.2, -0.88, 1.3>        texture { pigment {color rgb<2,
> 0, 0>}}} ;
>
>
> #declare reifen=
> union
>
> {
>
> torus{0.05,0.018
>           texture{pigment {color rgb<5, 5, 5>}}} // rim - Felge
>
> torus{0.06,0.02
>            texture{pigment {color rgb<0, 0, 0>}}} // tire - Reifen
> }  ;
>
>
>
> #declare Fahrzeug=
>
> union
> {
>
> object {FahrzeugKoerper}
>
>
> object {reifen translate<0.10, 0.985, 0.925>   rotate<90,0,0>}   //Vorne Rechts
>
>
> object {reifen translate<-0.20, 0.985, 0.925>   rotate<90,0,0>}  //Hinten Rechts
>
>
> object {reifen translate<0.10, 1.315, 0.925>   rotate<90,0,0>}   //Vorne Links
>
>
> object {reifen translate<-0.20, 1.315, 0.925>   rotate<90,0,0>}  //Hinten Rechts
>
> }
>
> #declare MySpline =
> spline {
>
>     cubic_spline
>
>     -1,<0, 0, 0>, // control point
>      0.00,<0.00,0.00,2.60>
>      1.00,<0.45,0.00,2.50>
>      2.00,<0.90,0.00,2.00>
>      3.00,<1.30,0.00,1.30>
>      4.00,<0.90,0.00,0.70>
>      5.00,<0.45,0.00,0.30>
>      6.00,<0.00,0.00,0.00>
>      7.00,<-0.45,0.00,-0.30>
>      8.00,<-0.90,0.00,-0.70>
>      9.00,<-1.30,0.00,-1.30>
>      10.00,<-0.90,0.00,-2.00>
>      11.00,<-0.45,0.00,-2.50>
>      12.00,<0.00,0.00,-2.60>
>      13.00,<0.45,0.00,-2.50>
>      14.00,<0.90,0.00,-2.00>
>      15.00,<1.30,0.00,-1.30>
>      16.00,<0.90,0.00,-0.70>
>      17.00,<0.45,0.00,-0.30>
>      18.00,<0.00,0.00,0.00>
>      19.00,<-0.45,0.00,0.30>
>      20.00,<-0.90,0.00,0.70>
>      21.00,<-1.30,0.00,1.30>
>      22.00,<-0.90,0.00,2.00>
>      23.00,<-0.45,0.00,2.50>
>      24.00,<0.00,0.00,2.60>
>      25.00,<0.00,0.00,2.60>
> }
>
> object { Fahrzeug Spline_Trans (MySpline, clock*25,<0,1,0>, 0.1, 0.00001) }
>
> -------------------
> My ini file is;
>
> Antialias=On
> Antialias_Threshold=0.2
> Antialias_Depth=3
>
> Input_File_Name=backup.pov
>
> Initial_Frame=1
> Final_Frame=25
> Initial_Clock=0
> Final_Clock=1
>
> Pause_when_Done=off
> Cyclic_Animation=off
>
>
> Thanks a lot in advance
>
> regards
> Yetkin
>
> (Sorry for my English)
>
>
I added the following to make your spline visible:
#declare Spl_Pos = 0;
union{
	#while(Spl_Pos <=25)
		sphere{MySpline(Spl_Pos)-1*y, 0.02}
		#declare Spl_Pos=Spl_Pos +1/4;
	#end
	pigment{rgb<1,1,0>}
	}

If you do the same thing, you'll clearly see that your spline don't 
follow your track at all. It start and end in the center of the top loop 
and cross in the center of the botom one.

You need to adjust your spline so that it follow the correct path.
You need to create your "car" at the origin. You can place the center of 
the car or the mid point of it's rear axle at <0,0,0>.
The bottom of the wheels should be at elevation zero.
The left side should located at -Right_Side.
Now, it goes from 1 to 1.3 while it MUST go from -0.15 to 0.15.
Spline_Trans assume that your object front points toward +z. As your,s 
point toward +x, it looks like it's moving sideway.
Same size, correct orientation, rear center at x=0, z=0:
box{<-0.15, -0.95, 0.6>, <0.15, -0.88, 0>

Change the controll point at -1 to <-0.45,0.00,2.50>
Change the controll point at 25 to <0.45,0.00,2.50>
This will ensure a smooth junction.
It's never advisable to have a controll point at the same location as 
the neibouring point.



Alain


Post a reply to this message

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