earth.render();
moon.render();
ship.render();
if (hud) {
RigidBody rb = ship.rigidBody();
Vector2 v = Vector2.fromAngle(-ship.ang.roll, 50 / viewpoint.scale);
Vector2 a1 = Vector2.fromAngle(-ship.ang.roll + 140, 10 / viewpoint.scale);
Vector2 a2 = Vector2.fromAngle(-ship.ang.roll - 140, 10 / viewpoint.scale);
glColor3f(1, 0, 0);
glBegin(GL_LINES);
glVertex2f(ship.pos.x, ship.pos.y);
glVertex2f(ship.pos.x + v.x, ship.pos.y + v.y);
glVertex2f(ship.pos.x + v.x, ship.pos.y + v.y);
glVertex2f(ship.pos.x + v.x + a1.x, ship.pos.y + v.y + a1.y);
glVertex2f(ship.pos.x + v.x, ship.pos.y + v.y);
glVertex2f(ship.pos.x + v.x + a2.x, ship.pos.y + v.y + a2.y);
glEnd();
Vector3 forceVector = rb.netForce();
glColor3f(0, 0, 1);
glBegin(GL_LINES);
glVertex2f(ship.pos.x, ship.pos.y);
glVertex2f(ship.pos.x + forceVector.x, ship.pos.y + forceVector.y);
glEnd();
glColor3f(0, 1, 0);
glBegin(GL_LINE_STRIP);
Vector3 curVel = rb.velocity.copy();
Vector3 curPos = ship.pos.copy();
glVertex2f(curPos.x, curPos.y);
float tick = 5f;
boolean readyToStop = false;
for (float t = 0; t < 8000; t += tick) {
Entity e = new Entity();
e.addBehavior(new RigidBody(curVel, Vector3.zero()));
e.rigidBody().addForce(moonGravity);
e.rigidBody().addForce(earthGravity);
e.pos = curPos;
Vector3 realAcc = rb.acceleration.plus(Vector3.divide(e.rigidBody().netForce(), e.rigidBody().mass));
Vector3 velOld = curVel;