You are viewing a single comment's thread from:
RE: Planets | A Multiplayer Planet Gravity Game
Here is the code: https://github.com/ajayyy/Planets/blob/master/Planets-Base/src/app/ajay/planets/base/PhysicsObject.java#L54
It is the same acceleration equation, but instead of using math to integrate it and find an equation for the position, the acceleration is calculated and then added to the velocity every frame. The velocities are then added to the position every frame.
The velocity is represented as xSpeed and ySpeed.
I know how to simulate it numerically, but how did your trial at a continuous solution look like?
As far as I found, there is no continuous solution sadly.
Do you know about the orbit equation? It might be used together with the second kepler law to create a useful equation.
Edit:
Just noticed that you are making gravity towards more then one object at once, so it is indeed not possible :(
Ooh, I never even tried to use that equation, thanks for linking it. Sadly, I don't think this equation will work since it still doesn't find a direction of that velocity, and still requires the positioning (radius), but I will look into using this one. Thanks!