I am trying to do some simple physic engine, and when I implemented gravity, I could see this :

Infinite Gravity Train

You can Imagine this as planets and they're attracting each other so in this situation, they can just go infinitely..

So I want to know if it is a mistake in my engine or if this really could work in the universe :) Thanks

  • 5
    $\begingroup$ You'll need to explain what "this" is. $\endgroup$
    – StephenG
    Dec 16 '17 at 23:14
  • $\begingroup$ I am looping through all particles and for each particle I am looping through all other particles and then adding the final gravity Vector to the particle. So my question is, can thing on the image happen in the universe with some objects, like use gravity as "Infinite energy"? I really don't know how to describe it.. $\endgroup$
    – Jacob
    Dec 16 '17 at 23:18
  • $\begingroup$ You should post your code since the behaviour you see might just be a bug. $\endgroup$ Dec 16 '17 at 23:57
  • $\begingroup$ Can you explain what about this model you feel is "infinite energy?" What I see is very typical discretization effects which occur when you have a simple physics model and run it with discrete time steps. However, it is entirely possible that the specific behaviors you are asking about have some real-life corollary. (Also, what sort of collision model do you have? It looks like you have implemented some rudimentary collision model, and that is likely a key player in the effects you are seeing) $\endgroup$
    – Cort Ammon
    Dec 17 '17 at 2:04
  • 1
    $\begingroup$ It looks bad. For example, the center of mass doesn't have constant speed as it should in the absence of external forces. Also, them lining up seems pretty strange. Besides gravity I suppose you have some short-range repulsion, right? When they collide, are the collisions elastic? $\endgroup$
    – stafusa
    Dec 17 '17 at 14:22

Assuming that there are no other bodies in the simulated universe besides those four circles, we can define a system of bodies such that there are no external forces acting on the system.

The four circles may exert forces on each other, but the center of mass of the system of the four circles will not accelerate because there is no external body from which a force could cause an acceleration.

With that logic, it is entirely possible for the four circles to keep moving in a straight line. However, it is unlikely (though still plausible) for the circles to be lined up as they are because the system would be more stable if the four circles bunched up in a ball as they move in a straight line.


Not the answer you're looking for? Browse other questions tagged or ask your own question.