Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Applying parabollic shooting

  1. Jun 17, 2003 #1


    User Avatar


    As a part of a subject project I'm developing a game. It is a kind of real-time strategy game where two teams of tanks have to destroy each other (not very original, but interesting enough).

    I have come across a problem I cannot solve: applying parabollic shooting to simulate their bullets.

    I use the typical formulas:

    where a=alpha, g=gravity (9.8 default) and v0=initial velocity modulus

    What happens is that I had always used these formulas to calculate some typical things like: maximum height reached, ending x, etc.

    But now, given an initial point, a final point and an initial velocity, I need to calculate the alpha that would take the bullet the minimum time.

    I need to have a function f(t), to minimize it to know the minimum time and then get the alpha. But I always get struck in the depths of the calculus.

    Can anybody help me, please? Thank you.
    Last edited by a moderator: Feb 5, 2013
  2. jcsd
  3. Jun 17, 2003 #2

    Tom Mattson

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Re: Ballistics

    Hi, and welcome to PF. Same Xev from sciforums and philosophyforums I presume?

    Actually, what you need is t as a function of α. You will want to differentiate t(α) with respect to α and set derivative equal to 0, yadda yadda yadda.


    It sounds like you've got the calculus and are getting lost in the depths of the algebra. :smile:

    I've highlighted the function you need above. You could alternatively use the equation for y, but it is more complicated so I'm sticking with the equation for x. What you do is solve it for t.


    Now, can you fill in the yaddas?
  4. Jun 17, 2003 #3


    User Avatar


    Hi there

    >>Same Xev from sciforums and philosophyforums I presume?

    I am afraid I don't even know of the existence these sci/philosofyforums.


    Since English is not my native language, I don't know what you mean by yadda yadda (maybe it means etc or something more specific?)

    -> my progress: i've taken care of your funcion, trying to minimize it. But I reach the following statement:
    cos(a) + x * sin(a)=0

    I should get the alpha as a function of x, but I cannot find any way to be able to isolate the alpha and to continue working on it. Do you know how these equations are solved? Thank you!

    >>Welcome to PF

  5. Jun 17, 2003 #4

    Tom Mattson

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Re: ballistics(2)

    Yes, it means "et cetera". It's from Seinfeld. :D

    t as a function of α is:


    You need to take the derivative of that with respect to α. Use the chain rule:


    That is what you should set equal to zero. Solve for α, and you have your angle that minimizes the time.

    Why are you looking for α as a function of x? x is fixed, and anyway you are trying to minimize the time. If I am understanding you correctly, you definitely need t as a function of α, as I outlined above.
  6. Jun 17, 2003 #5


    User Avatar



    then I do:

    ((x-x0)sin¥á)/(v0*cos2¥á)) = 0



    we get: a=k*PI

    referring to the original function, I substitute the reached alpha:


    Because we need positive times, I restrict alpha to being 2*k*PI

    then t(2*k*PI)=t(¥á)=((x-x0)/v0)/(cos(2*k*PI))= (x-x0)/v0

    So the conclusion is: the best alpha is 0¨¬
    This isn't useful for me, am I doing something wrong or maybe I amb approaching the problem with the incorrect method?

    Thank you !
  7. Jun 17, 2003 #6

    Tom Mattson

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    OK, I think I see the problem. What you have here is an overdetermined system, and this will become apparent when I eliminate the t from the parametric equations for x and y.


    Solve the first equation for t.


    Plug this into t in the second equation.


    I could clean this up a bit, but I don't need to to make my point. y, y0, x, x0, v0 and g are all fixed. α is the only thing left, so it is fixed too. You don't have freedome to let it vary to optimize the time.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook