Hey all! New here, and I apologize if this is either posted in the wrong place or if there's existing thread about this topic already. I'm curious if the devs have shared anything about what the physics updates look like for bodies in KSP, given the nature of Unity GameObjects, Rigidbodies, and the FixedUpdate and Update methods. I've been developing a simple 2D orbital mechanics game/sandbox for fun, in part to revisit classical mechanics concepts that I'm sadly far out of practice with, and it's raised a number of questions!
My original assumption was that bodies in KSP simply have one gravitational force applied to the body by means of the Unity-built-in Rigidbody.AddForce(<gravitational_force_applied via other body>) in a body's FixedUpdate() method, but given the 2-body nature of the game, this isn't necessary, considering such a system's deterministic nature and the ability to easily calculate elliptical, parabolic, or hyperbolic trajectories from just the masses, relative position, and relative velocity of the two bodies. In setting up some mechanics where I apply appropriate forces in the FixedUpdate() method, while also calculating a given orbit's semimajor axis, specific angular momentum, eccentricity vector, etc. in the object's Update() method, I've noticed that my parameters that ought to be conserved (e.g. specific angular momentum, specific orbital energy), are not quite as conserved as I'd like them to be.
I'm certainly not expecting perfection here, but the experience has mainly further amplified my appreciation for the physics of KSP.. The stability of orbits over time is fantastic! It has me wondering if, when a body stops accelerating by anything BUT gravity (i.e. we're not thrusting or interacting with an atmosphere), an equation for an ellipse/parabola/ hyperbola is determined and parameterized, and the body is then just updated along that path until some additional force outside gravity is applied.
Again, I'm new here so I apologize if this is common knowledge or well-documented, but a cursory search didn't lead me to anything, so I'm curious. Thanks for any information!