1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Physics 1 student, making a physics based and I need a little math help

  1. Mar 3, 2007 #1
    Hooray for long titles...

    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

    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?
     
  2. jcsd
  3. Mar 3, 2007 #2
    Not sure if this is any help, but from the hip, and assuming the "attractor" is much more massive than the "planet", I would put the attractor at the origin and resolve both velocities and acceleration into x and y components. If on successive time frames, the absolute value of the x or y position is becoming larger, then the acceleration is retarding, and vice versa.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Physics 1 student, making a physics based and I need a little math help
  1. I need help in physics (Replies: 2)

Loading...