|
|
Rotation and translation coupled together such as that of a ball rolling
along a floor takes the use of pi*(BallRadius*2)=Dist then translate Dist*x
for example.
Just a matter of moving along the same distance as the circumference of the
sphere. If more than one roll (>360 degrees) then you would just multiply
that amount by Dist. 720 degrees becomes 2*Dist*x
Bob
"SHELLEY" <SHE### [at] prodigynet> wrote in message
news:3907A02F.2A7AFFE7@prodigy.net...
| okay, im trying to create a simple animation where two balls roll into
| each other. My problem is that when the ball rotates 360 degrees it
| rotates really weird. Ive been playing with the code for awhile and I
| can't figure it out. here my source code:
|
|
| #include "colors.inc"
| #include "textures.inc"
|
| camera
| {
| location <0.5 , 0.0 ,-10.0>
| look_at <0.5 , 0.0 , 0.0>
| }
|
| background {SlateBlue }
|
| light_source
| {
| 0*x
| color rgb 1.0
| area_light
| <8, 0, 0> <0, 0, 8>
| 4, 4
| adaptive 0
| jitter
| translate <40, 80, -40>
| }
|
| file://#declare ground =
| box
| {
| <-1, -1, -1>
| < 1, 1, 1>
| pigment { Orange }
| scale 10
| translate -15*y
| scale <20,0,20>
| translate 4*y
| }
|
| file://#declare MainBall =
| sphere
| {
| <10, 0, 0>
| 1
| finish {phong 1 phong_size 90}
| pigment {checker Violet,Yellow rotate y*(clock*360)}
| translate x*(clock*-8)
| }
|
| file://#declare MainBall2 =
| sphere
| {
| <-10, 0, 0>
| 1
| finish {phong 1 phong_size 90}
| pigment {checker Black,Yellow rotate y*(clock*360)}
| translate x*(clock*10)
| }
|
| file://#declare hole =
| file://cylinder
| file://{
| // 0*x, 5*x, 2
| // pigment {Yellow}
| // rotate 90*z
| // translate <3,-5.99,0>
| file://}
|
| file://difference {
| // object{ ground }
| // object{ hole }}
|
| file://#declare holelight =
| file://cone
| file://{
| // 1*y, 0.0,
| // -1*y, 1.0
| // pigment {Yellow}
| // scale .5
| // translate <3,-1,0>
| // rotate 180*z
| // translate <6,-2,0>
| // scale 2
| // translate -3*x
| // translate -3*y
| file://}
|
| file://union {
| // light_source { <2,-2,0> color White }
| // object { holelight } no_shadow translate 1*y
| // }
|
Post a reply to this message
|
|