|
|
Hi!
Can somebody help me. 'm stuck in my rollercoaster scene. I've made a spline,
align a cones to the spline, but I can't made a track for my coaster
animation.I coulndt align any object to me spline. I knew that I must use the
spline_trans macro, but I can't do this. The track could be made from a boxes
or from tubes. Please help me. I will be grateful for help. This is a code of
my scene.
PS. Sorry for my English
#version 3.6;
global_settings { assumed_gamma 1.0 }
//------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "math.inc"
#include "transforms.inc"
//------------------------------------------------------------------------
camera {
angle 15
location <14.0 , 20.0 ,-60.0>
right x*image_width/image_height
look_at <-1.0 , 0.0 , 0.0>
}
//------------------------------------------------------------------------
// Słońce
-------------------------------------------------------------------
light_source{<-1000,2500,-2500> color White}
// Niebo -------------------------------------------------------------------
sky_sphere{ pigment{ gradient <0,1,0>
color_map{ [0 color rgb<1,1,1> ]
[0.4 color rgb<0.14,0.14,0.56>]
[0.6 color rgb<0.14,0.14,0.56>]
[1.0 color rgb<1,1,1> ]
}
scale 2 }
}
//------------------------------------------------------------------------
// Trawa
plane { <0,1,0>, 0
texture{ pigment{color rgb<0.35,0.65,0.0>*0.8}
normal {bumps 0.75 scale 0.015}
finish {ambient 0.1 diffuse 0.8}
}
}
//--------------------------------------------------------------------------
//--------------------------- obiekty w scenie ---------------------------
//--------------------------------------------------------------------------
//deklaracja krzywych
#declare N = 55;
#declare P = array[55];
#declare P[0] = <-6.00, 1.60, 0.00>;
#declare P[1] = <-6.00, 1.00, 2.00>;
#declare P[2] = <-5.90, 1.30, 3.00>;
#declare P[3] = <-5.60, 1.40, 3.80>;
#declare P[4] = <-4.70, 0.50, 6.00>;
#declare P[5] = <-3.50, 1.70, 9.00>;
#declare P[6] = <-3.00, 2.00, 9.50>;
#declare P[7] = <-2.00, 1.85, 10.00>;
#declare P[8] = <-0.50, 1.90, 11.00>;
#declare P[9] = < 0.50, 1.90, 12.50>;
#declare P[10]= <-0.50, 1.85, 13.50>;
#declare P[11]= <-2.00, 1.80, 13.00>;
#declare P[12]= <-2.50, 1.75, 11.50>;
#declare P[13]= <-3.00, 1.65, 9.00>;
#declare P[14]= <-4.25, 1.10, 6.00>;
#declare P[15]= <-5.25, 2.00, 3.50>;
#declare P[16]= <-5.40, 1.00, 2.80>;
#declare P[17]= <-5.50, 1.00, 2.00>;
#declare P[18]= <-5.50, 1.00, 0.00>;
#declare P[19]= <-5.50, 1.00, -1.00>;
#declare P[20]= <-5.40, 1.00, -2.00>;
#declare P[21]= <-5.00, 1.00, -3.00>;
#declare P[22]= <-4.20, 1.00, -4.50>;
#declare P[23]= <-3.50, 1.00, -6.00>;
#declare P[24]= <-3.00, 1.00, -7.50>;
#declare P[25]= <-2.50, 1.00, -9.00>;
#declare P[26]= <-2.30, 1.00, -10.50>;
#declare P[27]= <-1.50, 1.00, -12.10>;
#declare P[28]= < 0.00, 1.50, -13.00>;
#declare P[29]= < 1.75, 1.00, -13.00>;
#declare P[30]= < 3.50, 1.00, -13.00>;
#declare P[31]= < 5.00, 0.95, -11.80>;
#declare P[32]= < 4.70, 0.90, -10.20>;
#declare P[33]= < 3.10, 0.85, -10.50>;
#declare P[34]= < 3.60, 0.80, -12.00>;
#declare P[35]= < 6.00, 0.75, -12.00>;
#declare P[36]= < 7.20, 1.00, -10.00>;
#declare P[37]= < 7.80, 0.95, -8.00>;
#declare P[38]= < 7.30, 0.90, -5.80>;
#declare P[39]= < 6.50, 0.85, -4.25>;
#declare P[40]= < 4.80, 0.80, -3.60>;
#declare P[41]= < 3.00, 0.75, -3.80>;
#declare P[42]= < 2.20, 0.70, -4.60>;
#declare P[43]= < 3.00, 0.65, -5.50>;
#declare P[44]= < 5.00, 0.50, -5.00>;
#declare P[45]= < 6.10, 0.20, -5.50>;
#declare P[46]= < 5.20, 0.20, -6.50>;
#declare P[47]= < 2.50, 0.30, -7.20>;
#declare P[48]= < 0.00, 1.30, -7.80>;
#declare P[49]= <-2.20, 1.90, -8.20>;
#declare P[50]= <-4.00, 2.30, -8.60>;
#declare P[51]= <-5.70, 3.00, -8.50>;
#declare P[52]= <-6.00, 0.20, -7.00>;
#declare P[53]= <-6.00, 2.00, -4.50>;
#declare P[54]= <-6.00, 2.00, -2.00>;
#declare Spline_1 =
spline {
natural_spline
-0.018, P[54],
0.000, P[0], // start
0.018, P[1],
0.036, P[2],
0.054, P[3],
0.072, P[4],
0.090, P[5],
0.108, P[6],
0.126, P[7],
0.144, P[8],
0.162, P[9],
0.180, P[10],
0.198, P[11],
0.216, P[12],
0.234, P[13],
0.252, P[14],
0.270, P[15],
0.288, P[16],
0.306, P[17],
0.324, P[18],
0.342, P[19],
0.360, P[20],
0.378, P[21],
0.396, P[22],
0.414, P[23],
0.432, P[24],
0.450, P[25],
0.468, P[26],
0.486, P[27],
0.504, P[28],
0.522, P[29],
0.540, P[30],
0.558, P[31],
0.576, P[32],
0.594, P[33],
0.612, P[34],
0.630, P[35],
0.648, P[36],
0.666, P[37],
0.684, P[38],
0.702, P[39],
0.720, P[40],
0.738, P[41],
0.756, P[42],
0.774, P[43],
0.792, P[44],
0.810, P[45],
0.828, P[46],
0.846, P[47],
0.864, P[48],
0.882, P[49],
0.900, P[50],
0.918, P[51],
0.936, P[52],
0.954, P[53],
0.972, P[54],
1.000, P[0],
1.018, P[1]
}
//-------------------------------------------
#macro Ball (Point)
union{
sphere { <0,0,0>, 0.04
texture { pigment{ color Red } // rgb< 1, 0.0, 0.0>}
finish { ambient 0.1 diffuse 0.85 phong 1}
}
scale<1,1,1> rotate<0,0,0> translate<0,Point.y,0>
}
#if (Point.y > 0)
cylinder { <0,0,0>,<0,Point.y,0>,0.03
texture { pigment { color rgb<0.40,0.25,0.15>}
normal { bumps 0.5 scale <0.005,0.25,0.005>}
finish { ambient 0.15 diffuse 0.85 phong 0.5}
}
scale <1,1,1> rotate<0,0,0> translate<0,0,0>
}
#end
translate <Point.x,0,Point.z>
} #end //----------------------------------------------------------
union{
#declare Nr = 0;
#declare EndNr = 1;
#while (Nr< EndNr)
cylinder { <0,0,0>,<0,-Spline_1(Nr).y,0>,0.01
texture { pigment { color rgb<0.40,0.25,0.15>}
normal { bumps 0.5 scale <0.005,0.25,0.005>}
finish { ambient 0.15 diffuse 0.85 phong 0.5}
}
scale <1,1,1> rotate<0,0,0> translate Spline_1(Nr)-<0,0.30,0>
}
#declare Nr = Nr + 0.005;
#end
rotate<0,0,0>
translate<0,0.3,0>
}
//---------------------track------------------------------------------
#declare Track = box {
<-0.05 0.01 , 0>,
<0.05, 0.02, 0.1>
texture {
pigment { color Red }
}
}
#declare Nr = 0;
#declare EndNr = 1;
#while ( Nr< EndNr)
object {Track Spline_Trans(Spline_1, Nr, y, 0.1, 0.5)}
#declare Nr = Nr + 0.0005;
#end
Post a reply to this message
|
|