3
\$\begingroup\$

I have done some reading into this subject but haven't been able to come to a conclusion that I'm really satisfied with so far, so here is the situation. I have a game set in space, its top down and essentially 2D as far as physics is concerned and it revolves around the gravitational interaction between planets and black holes. I'm using Unity, so I have the ability apply forces to bodies. However, I have to do all the gravity calculations myself... This is where I get stuck.

Now it's not the maths that I'm having trouble with, maths I can do, its general game "feel" that is the sticking point. Originally I tried Newtons standard gravitational equations but I found that to a general user they produce unexpected behaviour. If you place two different mass planets on either side of a central black hole, both the same distance away, they will reach the central black hole at the same time (which "feels" odd). I also played around with more primitive implementations that just manipulate distance and mass in different ways but I always ended up with the same issue; as the planets im using undergo dramatic shifts in mass over the course of the game, the effect of the black holes always starts off being overly erratic (at low body masses) and then moves to being overly sluggish (at high masses) giving the game a very inconsistent feel at the moment.

Has anyone run into the same issue here and come out with a good way of simulating gravity in space? Does anyone know of examples of where this has been done before? What are some things that I may have overlooked or may want to take into consideration in the calculations? Remember that realism isn't the main concern here, its game "feel".

I'm open to any and all suggestions here so don't hesitate to put forward any sort of crazy answers!

\$\endgroup\$
2
  • \$\begingroup\$ If it "feels wrong" you can try treating gravity as a constant force per exerting body, rather than being proportional to the body experiencing the pull. \$\endgroup\$ Commented Aug 5, 2014 at 14:14
  • \$\begingroup\$ Do you also want to consider that, probably, objects nearer to a black hole are seen to move slowly from an outer eye due to the fact that immense gravity affects how time flows? \$\endgroup\$
    – Lighthink
    Commented Aug 5, 2014 at 14:45

1 Answer 1

1
\$\begingroup\$

The problem is that bodies only ever move towards stable orbits in 3D. In 2D they will not tent to move towards stable orbits using "realistic" physics. If you do want to get a stable orbit you will need to mess with the formula's that dictate speed. Completely forgoing Newton's laws in favour of a system with completely different exponents. For more information on orbits in various situations see here A second method is the just create a 3D model where all objects have very similar z-values, this is actually very close to how the actual milky way and solar system are.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .