0

I am making a simple coding project where a white dot is orbiting another dot. I could not find a mathematical formula to change the speed of the dot based on its movement direction proportional to the gravity. I have not taken physics yet so all of this is still very hard to me. While I know this is not stackoverflow.com, I thought that this issue would we relevant to me in both places. My source code is here: https://jsfiddle.net/L9bxa5km/2/

I know most of you are not coders, so I will break it down for you. The dot moves in a certain direction with a speed. Its angle of movement is affected by gravity to move towards the center. The only issue I have is the need for the speed of the ship to change based on the gravitational pull.

Qmechanic
  • 220,844
Athdot
  • 1

1 Answers1

0

If you know the concept of centrifugal force and the approximate mass of the middle object in reference to the orbiting object and the distance between, then try to place it like a planet in the solar system with a similar ratio. This should give you the speed. Hope this helps.

C.Chan
  • 1