Solar System (Gravity)
9 body
Large number
Importing & applying real data
Solar System
The Solar System is the gravitationally bound system of the Sun and the masses that orbit it, most prominently its eight planets, of which Earth is one.
https://en.wikipedia.org/wiki/List_of_Solar_System_objects_by_size
You may write these information in:
// Physical quantity of solar system. source: https://en.wikipedia.org/wiki/List_of_Solar_System_objects_by_size
planetProfile[0].name = "sun"; planetProfile[0].mass = 1989100000e21; planetProfile[0].distance = 0; planetProfile[0].speed = 0;
planetProfile[1].name = "mercury"; planetProfile[1].mass = 330.11e21; planetProfile[1].distance = 57.9e9; planetProfile[1].speed = 47.9e3;
planetProfile[2].name = "venus"; planetProfile[2].mass = 4867.5e21; planetProfile[2].distance = 108e9; planetProfile[2].speed = 35e3;
planetProfile[3].name = "earth"; planetProfile[3].mass = 5972.4e21; planetProfile[3].distance = 149e9; planetProfile[3].speed = 29.8e3;
planetProfile[4].name = "mars"; planetProfile[4].mass = 641.71e21; planetProfile[4].distance = 228e9; planetProfile[4].speed = 24.1e3;
planetProfile[5].name = "jupiter"; planetProfile[5].mass = 1898187e21; planetProfile[5].distance = 778e9; planetProfile[5].speed = 13.1e3;
planetProfile[6].name = "saturn"; planetProfile[6].mass = 568317e21; planetProfile[6].distance = 132e9; planetProfile[6].speed = 9.7e3;
planetProfile[7].name = "uranus"; planetProfile[7].mass = 86813e21; planetProfile[7].distance = 2867e9; planetProfile[7].speed = 6.8e3;
planetProfile[8].name = "neptune"; planetProfile[8].mass = 102413e21; planetProfile[8].distance = 4515e9; planetProfile[8].speed = 5.4e3;
Try the implementation
What is missing?https://github.com/sldsmkd/vector3d
*[Range of Float] Floating-point numeric types - C# reference | Microsoft Learn
Orbital Angle
How to scale down to visible range?
float scaledDistance = Mathf.Sqrt(real_position[i].magnitude / 1e8f);
There can be different solutions too. Any creative solutions?
Ok, 9 Body was boring but I could do it.
What if we have to import 1000 planet data? 10000?
Testing the cost of the computation
Stress your machine
What if the machine is the smartphone or VR?
Testing in VR
What if I want to simulate something more than gravity?