|
![](/i/fill.gif) |
There were a few things wrong, but to simplify it might be easier to compare
this with the other. Far as the math goes on this I'm no mathematician so this is
all I came up with. I'm not sure of the intent for this animation because one of
these balls rolls over a hole and doesn't fall in :-) Up to you I guess.
#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>
}
#declare ground =
box
{
<-1, -1, -1>
< 1, 1, 1>
pigment { Orange }
scale 10
translate -15*y
scale <20,1,20> // can't scale by 0, y changed to 1
translate 4*y
}
/* Amount of movement needs to be calculated first.
In this case it's -8*x and 10*x, or Dist*x
meaning the Rolls need to make abs(Dist)/(Rolls*(Radii*2*pi))
equivalent to 1.
Example: abs(-8)/(1.2725*(1*2*pi)) = 1
*/
#declare Rolls1=1.2725; // number of rolls
#declare Rolls2=1.59; // number of rolls
#declare Radii1=1; // ball radius
#declare Radii2=1; // ball radius
#declare MainBall =
sphere // +z rotation on y plane, -x direction
{
0, // don't translate first or texture will be offset
Radii1
finish {phong 1 phong_size 90}
pigment {checker color Violet, color Yellow}
// typically the object is rotated, not just the texture
rotate +z*(clock*Rolls1*360)
translate <10,0,0>-x*(clock*(Rolls1*((Radii1*2)*pi)))
}
MainBall // here's 1st object
#declare MainBall2 =
sphere // -z rotation on y plane, +x direction
{
0, // don't translate first or texture will be offset
Radii2
finish {phong 1 phong_size 90}
pigment {checker color Black, color Yellow}
// typically the object is rotated, not just the texture
rotate -z*(clock*Rolls2*360)
translate <-10,0,0>+x*(clock*(Rolls2*((Radii2*2)*pi)))
}
MainBall2 // here's 2nd object
#declare hole =
cylinder
{
0*x, 5*x, 2
pigment {Yellow}
rotate 90*z
translate <3,-5.99,0>
}
difference {
object{ ground }
object{ hole }}
#declare holelight =
cone
{
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
}
union {
light_source { <2,-2,0> color White }
object { holelight } no_shadow translate 1*y
}
Post a reply to this message
|
![](/i/fill.gif) |