thombruce / verse

🚀 A universe in progress
Other
8 stars 0 forks source link

Dynamic Orbits should relate to parent Mass #61

Closed thombruce closed 10 months ago

thombruce commented 10 months ago

Dynamic orbiting is the system (separate from the celestial Orbit system) responsible for pulling the player and enemy ships towards celestial bodies.

As of now, it is a constant for all bodies. But as I have begun to model the Solar System a little bit, I will be adding new masses to the planetary bodies and this should be reflected... somehow (none but Earth currently have moons).

Relate dynamic orbits to the mass of celestial bodies. Sol's pull should be stronger than Jupiter's should be stronger than Neptune's should be stronger than Earth's, etc.

First... Set the mass of each celestial to an appropriate value.

Then... Modify dynamic orbits to utilise the Mass component of the celestial bodies.

thombruce commented 10 months ago

This has now been (somewhat clumsily) handled here: b26dfd1ee2831583c762d22fffc64873448790f0

We're getting whichever is the lower of the 7th root of the mass or 9000.0 and applying this as an impulse to the ships.

Why the 7th root?

Trial, error and guesswork. I've left a todo on the implementation. The 7th root just happens to be what scaled the planetary masses down enough such that Earth's pull felt the same as usual, gas giants had a substantial weight to them and the Sun... well, the Sun still only just falls outside of the range where it's possible to escape the pull (hence the limit of 9000.0). By limiting this, we instead have a force that feels pretty substantial but can be escaped with persistence or ingenuity (a sort of slingshot method works beautifully).