haatreasure.blogg.se

3d solar system simulator game
3d solar system simulator game




In this case, i took the reference as "earth's radius." It basicly "normalizes" or in other words "scales" every property of a planet to a given reference. (Because why the heck would someone put "what would be the earth's mass if it had "that" radius chart" on the internet?) So, to keep the ratio of distance, radius and "mass" between planets fixed, i created an excel file to calculate all the datas. I searched every tiny bit of internet and i couldn't find a single explanation how people overcomes this. But there is a problem with the data size. I have been develeping n-body phyics to simulate our solar system, so i have been gathering data around to make it as realistic as possible. If i can overcome this, my problem will be solved. I don't know if it's exactly unity's problem or c#'s float.Īnd that's why i can't make it work with small values. But if the float is something like 23500, then it doesn't adds up the small values. When the float is 0, there is no problem with adding such small value. If i set the initial position of earth to 0,0,0 and still, set the acceleration to 0.0000000000000000009 to assuume it's position is (0,0,23500) position is still (0, 0, 23500) not something like (0,0, 23500.00000000000005), thus the earth doesn't move, thus the acceleration doesn't change. Well now when i add speed * timedelta (which is something like 0,00000000000000005 at this point) to position which is 23500, it basicly doesn't adds it. As the code flows, velocity increases as it should be, no problem with the float.īut in the beggining, the initial position of earth is (0,0,23500f) You can see this in the chart i gave at the end. I have something like this in my code Velocity += Acceleration * ltaTime I have been logging the values and searching where the exact problem is, and i think i found it. Important note: this question has utterly no relation to "PhysX", which is a computer-game-physics system (useful for the physics in arcade games such as ball games, etc) PhysX is a system built-in to Unit圓D and other game engines PhysX is totally irrelevant here.






3d solar system simulator game