public void draw() { /*---Update---*/ world.update(); worm.update(); for (int i = 0; i < extraNum; i++) { extraWorms[i].update(); } /*---Draw--*/ // Lights lights(); /* ambientLight(128f, 128f, 128f); directionalLight(128f, 128f, 128f, 0f, 0f, -1f); lightFalloff(1f, 0f, 0f); lightSpecular(0f, 0f, 0f); */ // Camera perspective(fov, aspect, near, far); // Calculate camera position if (PVector.dist(worm.getPosition(), eye) > eyeDist) { eye = PVector.sub(eye, worm.getPosition()); eye.normalize(); eye.mult(eyeDist); eye.add(worm.getPosition()); } camera( eye.x, eye.y, eye.z, // eyeX, eyeY, eyeZ (camera position) worm.getPosition().x, worm.getPosition().y, worm.getPosition().z, // centerX, centerY, centerZ (look at) 0f, 1f, 0f); // upX, upY, upZ // Action world.draw(); worm.draw(); for (int i = 0; i < extraNum; i++) { extraWorms[i].draw(); } // Drama! }