- #1
SacCno
- 2
- 0
- TL;DR Summary
- I'm trying to scale the solar system down to around 1:1,000,000,000 for a game I'm making, need help with scaling formulae, forces, velocities etc.
I'm trying to make a 2D game on Unity similar to Universe Sandbox 2. I currently am working with a star and planet, both with roughly the masses of the sun and earth respectively for comparison and at a distance of 31,000,000km.
My current model uses Newton's formula for gravitational force (F = GM1M2 / R2) and then dividing it by the planet's mass to get acceleration towards the star due to gravity. I then use the formula (v = √GMsun/R) to get the orbital velocity. My full process is as follows.
My issue came when I started the simulation and the ≈30m/s of initial velocity sent the planet shooting off into the cosmos. I've obviously made a big mistake somewhere in my calculations but after a few days of trial and error I still can't figure it out. I asked on the Unity forums and got some really handy tips for my simulation as a whole but nothing seemed to address my issue of how to scale my physics. I suspect that my scaling needs to be done inside the formulae to some degree but I've no idea where to start if that is the case.
Any help would be great, and if you need any more information please let me know.
My current model uses Newton's formula for gravitational force (F = GM1M2 / R2) and then dividing it by the planet's mass to get acceleration towards the star due to gravity. I then use the formula (v = √GMsun/R) to get the orbital velocity. My full process is as follows.
- Calculate force.
- Divide by planet's mass to get acceleration towards the star.
- Calculate orbital velocity.
- Divide both by 1,000,000,000 to get scaled down values.
- Multiply both by 525,600 (minutes in a year) to speed up simulation to one year per minute.
- Msun = 2e30kg
- Mearth = 6e24kg
- R = 31units * 1,000,000,000 = 31,000,000,000m
- G = 0.0000000000667
- Unscaled Orbital Velocity = 65,598.97718m/s
- Scaled Orbital Velocity = 34.4788224m/s = 34.4788224units/s
- Unscaled Force = 8.32882414e23N
- Scaled Force = 4.37762997e20N
- Unscaled Acceleration = 0.1388137357m/s/s
- Scaled Acceleration = 7.29604995e-5m/s/s = 7.29604995e-5units/s/s
My issue came when I started the simulation and the ≈30m/s of initial velocity sent the planet shooting off into the cosmos. I've obviously made a big mistake somewhere in my calculations but after a few days of trial and error I still can't figure it out. I asked on the Unity forums and got some really handy tips for my simulation as a whole but nothing seemed to address my issue of how to scale my physics. I suspect that my scaling needs to be done inside the formulae to some degree but I've no idea where to start if that is the case.
Any help would be great, and if you need any more information please let me know.