- #1
Chetic
- 8
- 0
I'm toying with the idea of making a little 2D space orbiter game so I've implemented Newton's universal gravity law into this little app. It works really well, even.
The problem I'm having is when I want to create an asteroid-belt. I spawn little asteroids randomly around an area around the sun and give them a starting velocity vector v that is based on their position relative to the sun. Then I rotate v 90 degrees by multiplying with a transformation matrix.
After that I'm just guessing basically. Though I have tried many different ideas based on some calculations. At the moment I multiply v by r^-2 (where r is the distance to the center of the sun) but that sure isn't it. Help?
The problem I'm having is when I want to create an asteroid-belt. I spawn little asteroids randomly around an area around the sun and give them a starting velocity vector v that is based on their position relative to the sun. Then I rotate v 90 degrees by multiplying with a transformation matrix.
After that I'm just guessing basically. Though I have tried many different ideas based on some calculations. At the moment I multiply v by r^-2 (where r is the distance to the center of the sun) but that sure isn't it. Help?