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!

Basic Projectile Physics

  1. Aug 26, 2007 #1
    I'm trying to simulate a projectile launch like this ( http://galileo.phys.virginia.edu/classes/109N/more_stuff/Applets/ProjectileMotion/jarapplet.html ). I googled but the results aren't specific.

    What would you set the x and y of an object when time ( t ) is updated, assuming you have these vars:

    * angle ( a )
    * velocity ( v )
    * x0 ( initial x )
    * y0 (initial y)
    * Not sure if necessary, but if so gravity (g)


    Also, given a projectile at its initial position'(x0, y0) and angle 'a', how can I solve for the velocity (v) to make it pass through a point (x, y)?

  2. jcsd
  3. Aug 26, 2007 #2


    User Avatar
    Homework Helper

  4. Aug 26, 2007 #3
    you need to know vectors, in order to make those like simulations.
    you making it in java?!
    I would be interested working *against* you! -- don't have anything else to do
    Last edited: Aug 26, 2007
  5. Aug 26, 2007 #4
    Thanks for the link. This is for computer programming by the way, not a physics course. :)

    So is this it then?

    x = vel*cos(θ)*t
    y = -½ g*t^2 + vel*sin(θ)*t

    Any idea of a formula for finding the second part?

    Thanks for the offer, but I just need to find this one thing and then apply it to a bigger school project I am working on. :)
  6. Aug 26, 2007 #5
    Last edited: Aug 26, 2007
  7. Aug 26, 2007 #6
    for the second part, you need to solve your parabolic equation, i guess.

    so make it like y=..x

    and then solve it
  8. Aug 26, 2007 #7
    Don't have time to open your project right now, but Ill take a look at it later.

    >>What's the project about?

    It's a 2D platformer that resembles gameplay similar to sonic. It's beign developed in both Java (as an applet) and Flash (ActionScript 3, as a swf).


    Okay the projectile launch seems pretty realistic. Here's how I have it:

    int xzero = obj.x;
    int yzero = obj.y;
    int t = 0;
    int vel = 100;
    int theta = 45;

    On thread call (every 1/35 of a second):

    t += 1/35;
    obj.x = vel*Math.cos(theta*(Math.PI/180))*t+xzero;
    obj.y = 16*t*t -vel*t*Math.sin(theta*Math.PI/180)+yzero;

    But now I'd like to calculate the velocity required to hit point x2,y2 from initial point xzero, yzero with angle 45. How would I do this?

    Appreciate all the help.
  9. Aug 26, 2007 #8
    in that original equation,
    first isolate t in the x equation {x = x0 + vel*cos(θ)*t}

    and substitute t value into the y equation
    and then you can isolate v..
  10. Aug 26, 2007 #9
    I'm a little confused. If I were to do that (isolate velocity in the obj.y assignment), I'd need to know what the obj.y equals, and to calculate that I need the velocity, so it's like an endless loop.
  11. Aug 26, 2007 #10
    no y equals to y2
    and x equals to x2,
    in those equations
  12. Aug 26, 2007 #11
    Oh, of course, that's genius! Ill try it out. :)
  13. Aug 26, 2007 #12
    I guess you would also need mathematical co-ordinates, as computer screen is in pixels lol

    >(evil smile)<
  14. Aug 26, 2007 #13
    Okay I got this far:

    x = x0 + vel * cos(ang)*t
    t = x/x0 + vel * cos(ang)
    y = y0 + 16 * t^2 - vel * t * sin(ang)
    y = y0 + 16 * (x/x0 + vel * cos(ang))^2 - vel * (x/x0 + vel * cos(ang)) * sin(ang)
    vel = ?

    Now I need to isolate vel, but I'm not sure exactly how.
  15. Aug 26, 2007 #14
    just a sec.

    if you are free, can you define what you are trying to do here?
    because I might help you coming up with an alternative solution
    Last edited: Aug 26, 2007
  16. Aug 26, 2007 #15
    [tex]\left| x\right| \,\sqrt{\frac{g}{x-y}}[/tex]

    or, substitude x-x0 for x, if you want from x0,y0 point; also add "y0" to the y equation

    P.S. check this for like two cases
    Last edited: Aug 26, 2007
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Basic Projectile Physics