thombruce / verse

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

add simple gravitational impulse attracting ship to orbitables #45

Closed thombruce closed 1 year ago

thombruce commented 1 year ago

closes #35

By submitting this pull request, you agree to follow our Code of Conduct: https://github.com/thombruce/.github/blob/main/CODE_OF_CONDUCT.md


Internal use. Do not delete.

thombruce commented 1 year ago

Consider this good enough for now.

Physics will be reworked a ways down the line. The important thing for now is that the ship stays close to a parent body while it orbits, which it now does.

Only things I might consider changing before merging are...

Planetary SOIs: Outside of a certain radius, the star's gravity should dominate (maybe bevy_spatial's within_distance helps with this, but probably not - that's more of a query for all entities within a range).

Star non-influence: I'm not sure how much sense it makes for the star's pull to take effect at massive distances. In real simulator terms, I know it would... but if the player is adrift in deep space I don't see the need to apply - I think the player should be able to hold position if they are outside of a certain range of a parent body (at least with the current physics system).

Both of these can be fixed with the same resolution: If the parent is greater than X distance away, we simply don't apply the impulse - this is the same for stars and planets alike. The length should be approximately equivalent to around a single screen width.

thombruce commented 1 year ago

1500.0 feels about right for the range of the pull's influence.

The effect will be applied a certain distance outside of the screen width, but it isn't so close as to require a lot of precision, and you can still go flying past these bodies at speed.

The feel is arcadey, rather than simulatory, but that's largely what we're going for.

This will be modified in a future physics update, no doubt.