From 9bb162e7d539374d45781b90ba713a9859c1e719 Mon Sep 17 00:00:00 2001 From: Paul Mathieu Date: Sun, 20 Nov 2022 17:53:12 -0800 Subject: [PATCH] orbit: fix planets not orbiting --- skycraft/index.ts | 3 ++- skycraft/orbit.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/skycraft/index.ts b/skycraft/index.ts index 912e87c..9ad907a 100644 --- a/skycraft/index.ts +++ b/skycraft/index.ts @@ -363,7 +363,8 @@ async function main() { // [ ] landing // [ ] huge planets // [x] lighting - // [ ] better lighting + // [x] better lighting + // [ ] betterer lighting // [x] optimize geometry generation const modelPromise = loadObjModel('spaceship.obj'); diff --git a/skycraft/orbit.ts b/skycraft/orbit.ts index 5c7837f..5d85620 100644 --- a/skycraft/orbit.ts +++ b/skycraft/orbit.ts @@ -181,7 +181,7 @@ export function getCartesianState(orbit: Orbit, mu: number, time: number) { // Newton's method var E2 = 0; - var E = orbit.lastE || M; + var E = M; let iterations = 0; // a clever guess? https://link.springer.com/article/10.1023/A:1008200607490 // doesn't work at all.