Hooray for long titles...(adsbygoogle = window.adsbygoogle || []).push({});

Anyway, I wasn't quite sure where to post this, sorry if this is in the totally wrong forum.

As you may have gathered from the title, I am attempting to make a physics based game. The primary equation in this game is Newton's gravity equation.

F = G(m1*m2)/(r^2)

I mangled it to where it actually works with numbers thrown around in the game while not changing it too much, but here's my problem, my game is on a 2D plane, and I cannot figure out how to get my movement to work out right.

I fuse the x-axis and y-axis distances in to one distance at the beginning, and, of course, to get what I want to move I have to split that value up using cos and sin. So I split it up after I find the acceleration from the force and then check the distances to see if the acceleration should be positive or negative. It ends up that in certain cases, the planet will sort of wobble back and forth as it moves.

it's easier to show: http://ian.janasnyder.com/phys.png [Broken]

I think my problem is that I should be splitting up the speed rather than acceleration, but then how do I tell whether to add or subtract acceleration?

Any tips?

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Physics 1 student, making a physics based and I need a little math help

**Physics Forums | Science Articles, Homework Help, Discussion**