How to handle large masses/big differences in mass?

Hi,

I’m doing a solar system simulation. It includes planets, a sun and spacecrafts.

To simulate the physics, I use Rigidbodies with gravity turned off. I then have a script that goes trough every pair of rigidbodies to apply a 3D-gravitational force to them according to Newtons universal law of gravitation.

This has worked for testing but now I noticed that Rigidbody.mass has a maximum of 1e9. This is a problem because I can’t have a satelite with e.g. 0.2t (rigidbody.mass == 0.2 with my current system of units) and planet (let alone a sun) with e.g. 5e21t (rigidbody.mass == 5e21 with my current system of units).

Do you have any idea how to solve that issue? I’d like to stick as close to unity’s physics standard because it runs more reliably (I am willing to use packages though).

Thanks a lot for your help, I really appreciate it!

Any mass difference beyond about 10:1 in a single-precision physics engine running at everyday useful solver iteration counts will get pretty squirrelly.

Orbital mechanics (even two bodies of nearly-identical mass orbiting each other) in a discrete physics simulator also quickly become unstable due to accumulating error.

tl;dr, a rigidbody game-focused physics engine is not suited to accurately model such things.

1 Like

Thanks for your reply. If rigidbody physics aren’t suitable for that, do you have any suggestion on a physics engine that is?
Writing continous physics myself won’t work because I want to manually apply forces that aren’t taken into accout in all continous models it know (like Keplerian laws). And writing a discrete physics myself will be even less precise than rigidbodies.

TL;DR: What should I do instead?