X
Y
Altitude (km)
Speed
dt = .001; running=true; x=0; y=1.02; vx=1; vy=0; xb[1]=x; yb[1]=y; StepModel();
r=Math.sqrt(x*x+y*y); accx= -x/(r*r*r)+lift*x/r+(thrust-drag)*y/r; accy= -y/(r*r*r)+lift*y/r+(thrust-drag)*x/r; vx+=accx*dt; vy+=accy*dt; x+=vx*dt; y+=vy*dt; xb[1]=x; yb[1]=y; if(r<1.0001){drag=0.1;}else{drag=0;} document.inputs.height.value = Math.floor(6000*(r-1)); document.inputs.posx.value = Math.floor(6000*x); document.inputs.posy.value = Math.floor(6000*y); document.inputs.speed.value = Math.floor(10000*Math.sqrt(vx*vx+vy*vy))/10000; if(r<1){ running=false; document.inputs.posx.value = "Crashed!!!" b[1].src="crash.gif"; } rotate(); if(running){setTimeout('StepModel()',10);}