Calculating Orbit Velocity Around a Star

Click For Summary
SUMMARY

The discussion focuses on calculating orbital velocity around a star using Newton's universal gravity law for a 2D space orbiter game. The user successfully derived the orbital velocity formula, v = √(G M / r), where G is the gravitational constant, M is the mass of the star, and r is the distance from the star. The initial issue involved incorrect vector rotation, which was resolved through community assistance. The implementation of the formula allowed for accurate asteroid spawning and movement in the game.

PREREQUISITES
  • Understanding of Newton's universal gravity law
  • Familiarity with 2D vector mathematics and transformation matrices
  • Knowledge of gravitational constant (G) and mass (M) in orbital mechanics
  • Basic programming skills for game development
NEXT STEPS
  • Research "Newton's laws of motion in game physics"
  • Learn about "2D vector rotation and transformation matrices"
  • Explore "orbital mechanics and gravitational interactions in game design"
  • Study "implementing physics engines in 2D games" such as Box2D
USEFUL FOR

Game developers, physics enthusiasts, and anyone interested in implementing realistic orbital mechanics in 2D games.

Chetic
Messages
8
Reaction score
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?
 
Physics news on Phys.org


An object is in circular orbit when its centripetal acceleration is equal to the gravitational acceleration:
[tex]\frac{v^2}{r} = \frac{G M}{r^2}[/tex]
solving for v:
[tex]v = \sqrt{\frac{G M}{r}}[/tex]
 


Hah! It works!
Now the problem turned out to be that my vectors were rotated incorrectly, but your answer helped me realize what wasn't wrong so thank you very much!

Here's a li'l pic of it at the moment:
http://img814.imageshack.us/img814/3983/gasim.png"
 
Last edited by a moderator:

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 18 ·
Replies
18
Views
5K
  • · Replies 10 ·
Replies
10
Views
5K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K