#version unofficial megapov 1.0; #declare MSim_Tex_Mesh = texture {pigment {color rgb 0.5} finish {specular 0.8 roughness 0.001}} #include "mechsim.inc" #declare Environment = plane {y,0} global_settings { mechsim { gravity y*-9.81 method 1 environment { object Environment damping 0.5 friction 0.2 method 2 } collision { 0,2 stiffness 20000 damping 5000 friction 0.8, 1.01 } #if (clock_on) step_count 5000 time_step (1/30)/5000 topology { load_file "dominoes.mech" save_file "dominoes.mech" } #else step_count 0 topology { //This group here is a simply pendulum to hit the first domino with group { mass {<1,3,4>,<0,0,0>,0.1 density 5000 fixed on} mass {<3.25,3,4>,<0,0,0>,0.1 density 1000} connection {0,1 stiffness 20000 damping 5000} } //This loop creates the dominoes using the off-the-shelf box macro. #declare loop = 0; #while (loop < 9) //This transform is applied to each domino to lay them in a curved track. #declare Move = transform {translate <4,0.001,0> rotate <0,-90-(loop*7),0>} group {MechSim_Generate_Box(<0,0,0>, 0.025, 100, 20000, 5000, true, <0.5,1,0.1>, <2,2,2>, Move, 4)} #declare loop = loop + 1; #end save_file "dominoes.mech" } #end } } //Scene geometry plane {y,0 pigment {color rgb<1,0.9,0.8>} finish {ambient 0 diffuse 1}} light_source {<30,100,-30> color rgb 1} camera {location <3,3,0> look_at <-1,1,4>} fog {color rgb 1 distance 100} //Off-the-shelf macro that displays the dominoes as meshes MechSim_Show_All_Objects(-1, true, 1, "") //Here's the pendulum that starts things off. sphere {mechsim:mass(1):position,0.1 pigment {color rgb <1,0.5,0.25>} finish {specular 0.9 roughness 0.001}} sphere {mechsim:mass(0):position,0.1 pigment {color rgb <1,0.5,0.25>} finish {specular 0.9 roughness 0.001}} cylinder {mechsim:mass(0):position,mechsim:mass(1):position,0.0125 pigment {color rgb 0}}