# Rolling ramp: one sphere, one real ramp, and no scripted trajectory. mkdir("build/physics"); program=_lmcode_ cli="lmvideo" install="github:lmctl-ai/lmvideo@v0.1.38"; let w=physics_world(0.008333333,91).gravity(0.0,-9.81,0.0).planar(true); w.box(12.0,0.35,4.0,0.0,-0.2,0.0,0.0,physics_material(0.8,0.1));w.box(4.0,0.35,2.0,-2.4,1.0,0.0,0.0,physics_material(0.8,0.1)).rotation(0.0,0.0,-18.0); w.sphere(0.4,-3.4,2.4,0.0,1.0,physics_material(0.28,0.72));let take=w.bake(180,1); video.size(512,384);video.fps(24);video.frames(96);video.output("build/physics/rolling-ramp.mp4");video.begin();let s=scene3d().background("#121a2a").ambient(0.25);let c=camera3d().look_at(7.0,4.0,9.0,0.0,0.7,0.0).perspective(42.0,0.1,40.0); for(f in range(0,video.count())){video.frame();let q=sin(3.1415926535*float(f)/96.0);let t=q*q;s.clear().camera(c).shadows(256,0.0004,0.001,1).directional_light(-2.0,5.0,4.0,"#ffefd4",1.4);s.add(mesh_box(12.0,0.35,4.0),"#c49b74").position(0.0,-0.2,0.0);let ramp=s.add(mesh_box(4.0,0.35,2.0),"#d9b27d");ramp.position(-2.4,1.0,0.0).rotation(0.0,0.0,-18.0);let n=s.add(mesh_sphere(0.4,20,28),"#e7b754");take.pose(t,2).sync(n);let im=s.render_image(512,384,2);canvas.clear("#101827");canvas.image(im,0.0,0.0);canvas.text("time-replayed physics",16.0,28.0,font(15.0),paint().color("#fff1d6"));if(f==40){im.save("build/physics/rolling-ramp.png");}} video.end(); end _lmcode_ r=run_lmcode(program);assert(r.ok,(r.ok ? "" : r.message));