- #1
CrosisBH
- 27
- 4
Code: https://pastebin.com/5LajNBpj
So I was messing with VPython, trying to create an Earth-Moon System. I got the actual gravity to work, and can create some nice ellipical orbits. However I run into trouble trying to make the actual (almost) circular orbit of the moon.
I know that the circular orbit velocity is given by v = √(GM/r). I put the moon at <3.8e8,0,0> and Earth in the center, so natural I assigned the initial velocity to the y of the moon since the velocity is tangent to the source of the gravity. (line 27)
However when I do this, I get the right velocity (~10000 m/s), but instead of orbiting circular it shoots off in the y direction leaving the gravity well of Earth. I've been looking through this code and can't find where it went wrong. Can someone have a look at it?
So I was messing with VPython, trying to create an Earth-Moon System. I got the actual gravity to work, and can create some nice ellipical orbits. However I run into trouble trying to make the actual (almost) circular orbit of the moon.
I know that the circular orbit velocity is given by v = √(GM/r). I put the moon at <3.8e8,0,0> and Earth in the center, so natural I assigned the initial velocity to the y of the moon since the velocity is tangent to the source of the gravity. (line 27)
However when I do this, I get the right velocity (~10000 m/s), but instead of orbiting circular it shoots off in the y direction leaving the gravity well of Earth. I've been looking through this code and can't find where it went wrong. Can someone have a look at it?