// tippe-top example // // setup scene scene.backColor=RGB(0,0,0); factory.useDegrees = true; scene.gravity = {0,-9810, 0}; // mm/s2 scene.camera = {-7,35,-75}; scene.lookAt = {4,30,0}; //material, mu = .6 var mat = Material(1e-7, 20, .95, 0.6, 0.6); factory.material = mat ; // the floor var tex = Texture("hv_bars_4.jpg"); var flr = Box({1000,10,1000}, {0, -5,0}); flr.static = true; flr.useTexture(tex,0, 5,5); // the tippetop class tippetop { var s = Sphere(25, {0, 0,0}); //main sphere s.rotate(0,90,0); // just for the texture display var tip = Sphere(10, {25,0,0}); // the tip tip .rotate(0,90,0);// just for the texture display var c = Sphere(15,{-10,0,0});// the center of mass is opposite to the tip c.material = Material(1e-6, 20, .95, 0.6, 0.6); // density is larger }; var tt = tippetop(); // tippetop dressing var hv_tex = Texture("grid.jpg"); tt.useTexture(hv_tex, 0,2,2); tt.color = RGB(255,0,0); tt.specular = RGB(16,16,16); tt.sharpness = 50; // initial position / verlocities tt.move(0,25,0); tt.rotate(0,0,80); tt.velocity = {100,0,200}; tt.rotVelocity = {0,250,0}; // generate a trace var tr_C = Trace(tt.s, {0,0,0}, 500); tr_C.color = RGB(0,0,255); // simulate the scene simulator.stepsize = 1e-4; while (simulator.time < 1) { simulator.run(1e-3); WaitFrame(); };