GDScript - 2D Orbits from State Vectors
The Pathfinders Codex The Pathfinders Codex
298 subscribers
306 views
20

 Published On May 11, 2024

Here's a video showing the steps in Godot 4.2 GDScript to take an object's state vectors and try to calculate an elliptical orbit and orbital elements, in 2D space. This is hobby code so it likely has bugs and it definitely has precision issues.

All of our projects will be on GitHub soon so please subscribe to get notified when the repositories are made public.

The Keplerian orbital elements are:
-Semi-Major Axis (a)
-Eccentricity (e)
-Inclination* (i)
-Longitude of the Ascending Node* (Ω) - capital case Omega
-Argument of Periapsis (ω) - lower case Omega
-True Anomaly (ν) - Nu
-Mean Anomaly (M)
In 2D, we do not use the Inclination or the Longitude of the Ascending Node.

Correction #0 - incorrect formula for semi-minor axis. It should be something like: semiMinorAxis = a * sqrt(1 - e * e)

show more

Share/Embed