13
Nov
Black Art of Java Game Programming by Joel
try{ InputStream is=new URL(getCodeBase(),”cube.f3d”).openStream(); cube=new fConvexPolyhedron(is); } catch(Exception e){e.printStackTrace();} //– create 9 instances of the cube cubeInstance=new fPolyhedronInstance[9]; for(int n=0; n<9; n++){ cubeInstance[n]=new fPolyhedronInstance(cube); } //-- //-- create the positions and angle //-- pos=new fPoint3d[9]; int n=0; for(int y=-5; y<=5; y+=5){ for(int x=-5; x<=5; x+=5){ pos[n]=new fPoint3d(x,y,0); n++; } } agl=new fAngle3d(); //-- //-- start the thread //-- myThread=new Thread(this); myThread.start(); } public void run(){ while(true){ //-- //-- sleep 1/10 of a second //-- try { myThread.sleep(100); } catch ( InterruptedException e) {} //-- //-- update the angle of the models //-- agl.x+=Math.PI/20; agl.y+=Math.PI/30; //-- //-- update camera angle and position //-- CamPos.z+=0.2; CamAngle.z+=Math.PI/50; camera.setOrientation(CamPos,CamAngle);
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra servlet hosting services
