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

Trajectory, equation

  1. Mar 3, 2010 #1
    I have never taken any physics course before, but I am designing a game in which the projectile(bullet) is going to drop over time.

    I want to know which equation do I use to calculate the position on a trajectory. Given that I have the angle, and initial velocity.


    From this would it be the Derivation of the equation of motion as it is the only one I can see there that is returning a y value.

    Secondly, if this is true, would the black trajectory here:


    Represent the kind of output I'm going to see, since (at the moment) I am not incorporating any drag?

    Thanks in advance
  2. jcsd
  3. Mar 3, 2010 #2

    Gib Z

    User Avatar
    Homework Helper

    Yes the equation you found indeed gives the height of the trajectory if you know the horizontal displacement. You stated you know the angle and initial velocity, but to get the height you would need either the time is has been travelling or the displacement horizontally. If you have time rather than horiontal displacement, you need a different equation.

    And yes, if you are not incorporating any drag it is true that a) The motion will be parabolic and b) the trajectories that reach higher peaks have a longer time of flight.
  4. Mar 7, 2010 #3
    Oddly enough, I came here to ask a similar question.

    I'm trying to implement a similar situation in a game, but I'm having issues coming up with a good formula.

    If I have an object starting an an arbitrary point in 2d space (x,y), how can I calculate the trajectory angle needed in order to "throw" an object and ensure it lands at a second point in 2d space. In my scenario gravity is known, initial velocity is known, and the time it takes to get to the second point is irrelevant. I simply need to calculate the angle I need.

    Any ideas?
  5. Mar 7, 2010 #4
    Yeah actually, after a lot of searching I came across this

    http://babek.info/libertybasicfiles/lbnews/nl130/proj3d.htm [Broken]

    Implemented that in C++, works perfectly.
    Last edited by a moderator: May 4, 2017
  6. Mar 7, 2010 #5

    Basically, you have a set of simultaneous equations, one for y-displacement and one for x-displacement, and you can solve for independently. You can break the initial velocity into x and y compoments dependent on the angle of fire.
  7. Mar 9, 2010 #6
    (Note that these formulas have the following assumptions: angles in degrees, distance in meters and that the acceleration of gravity is 9.8 m/s2)

    Given the initial velocity Vi and the trajectory angle [itex]\alpha[/tex], you have horizontal and vertical components of the initial velocity:
    Vix = Vi [itex]\times[/tex] cos([itex]\alpha[/tex]), Viy = Vi [itex]\times[/tex] sin([itex]\alpha[/tex])

    Likewise, given the angle [itex]\beta[/tex] and distance D to the target, there is a horizontal and vertical displacement:
    Dx = D [itex]\times[/tex] cos([itex]\beta[/tex]), Dy = D [itex]\times[/tex] sin([itex]\beta[/tex])

    The time it takes for the projectile to cover the horizontal distance can be found by:
    (1) t = [tex]\frac{D_x}{V_{ix}}[/tex]

    The vertical offset over time t, can then be found by:
    (2) Dy = [tex]V_{iy}\cdot t - 4.9 \cdot t^2[/tex]

    In your case, the angle [itex]\alpha[/tex] is unknown and therefore, so are Vix and Viy, so substituting equation (1) into equation (2) gives us:
    [tex]D_y = V_{iy} \cdot \frac{D_x}{V_{ix}}-4.9 \cdot \left( \frac{D_x}{V_{ix}} \right)^2[/tex]

    [tex]D_y=\frac{V_{ix} \cdot V_{iy} \cdot D_x}{{V_{ix}}^2} - \frac{4.9 \cdot {D_{x}}^2}{{V_{ix}}^2}[/tex]

    [tex]D_y=\frac{V_{ix} \cdot V_{iy} \cdot D_x - 4.9 \cdot {D_x}^2}{{V_{ix}}^2}[/tex]

    [tex]D_y \cdot {V_{ix}}^2 = D_x \cdot V_{iy} \cdot V_{ix} - 4.9 \cdot {D_x}^2[/tex]

    [tex]D_y \cdot {V_{ix}}^2 + 4.9 \cdot {D_x}^2 = D_x \cdot V_{iy} \cdot V_{ix} [/tex]

    Squaring both sides, we get
    (3) [tex]{D_y}^2 \cdot {V_{ix}}^4 \; + \; 9.8 \cdot D_y \cdot {D_x}^2 \cdot {V_{ix}}^2 \; + \; 24.01 \cdot {D_x}^4 = {D_x}^2 \cdot {V_{iy}}^2 \cdot {V_{ix}}^2 [/tex]

    Now, we know that Vix2 + Viy2 = Vi2 and therefore Viy2 = Vi2 - Vix2

    substituting into equation (3) gives us:
    [tex]{D_y}^2 \cdot {V_{ix}}^4 \; + \; 9.8 \cdot D_y \cdot {D_x}^2 \cdot {V_{ix}}^2 \; + \; 24.01 \cdot {D_x}^4 = {D_x}^2 \cdot ({V_i}^2 \; - \; {V_{ix}}^2) \cdot {V_{ix}}^2 [/tex]

    Multiplying out and rearranging, we have:
    [tex]{D_y}^2 \cdot {V_{ix}}^4 \; + \; {D_x}^2 \cdot {V_{ix}}^4 \; + \; 9.8 \cdot D_y \cdot {D_x}^2 \cdot {V_{ix}}^2 \; - \; {D_x}^2 \cdot {V_i}^2 \cdot {V_{ix}}^2 \; + \; 24.01 \cdot {D_x}^4 = 0[/tex]

    [tex]({D_y}^2 \; + \; {D_x}^2) \cdot {V_{ix}}^4 \; + \; (9.8 \cdot D_y \cdot {D_x}^2 \; - \; {D_x}^2 \cdot {V_i}^2) \cdot {V_{ix}}^2 \; + \; 24.01 \cdot {D_x}^4 = 0[/tex]

    But, since Dx2 + Dy2 = D2, we have:
    (4) [tex]D^2 \cdot {V_{ix}}^4 \; + \; (9.8 \cdot D_y \cdot {D_x}^2 \; - \; {D_x}^2 \cdot {V_i}^2) \cdot {V_{ix}}^2 \; + \; 24.01 \cdot {D_x}^4 = 0[/tex]

    The equation (4) is a quadratic and Vix is the only unknown variable.

    Remember that for quadratics of the form ax2 + bx + c = 0, we solve for x by using the quadratic formula:
    [tex]x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}[/tex]

    In your case,
    [tex]x = {V_{ix}}^2[/tex]

    [tex]a = D^2[/tex]

    [tex]b = 9.8 \cdot {D_x}^2 \cdot D_y - {D_x}^2 \cdot {V_i}^2[/tex]

    [tex]c = 24.01 \cdot {D_x}^4[/tex]

    Solving the quadratic equation is easier done in parts: We already have determined a, b, & c. The value under the radical sign of the quadratic formula (b2 - 4ac) is known as the determinant. Let's call "d" the square root of the determinant. So now you'll have to solve for d:
    [tex]d = \sqrt{b^2 - 4ac}[/tex]

    and then plug the rest of the numbers into each of the following equations:

    [tex]{V_{ix}}^2 = \frac{-b + d}{2a}[/tex] and
    [tex]{V_{ix}}^2 = \frac {-b - d}{2a}[/tex]

    and solve for [tex]V_{ix}[/tex] in each case.

    Call the results [tex]V_{ix1}[/tex] and [tex]V_{ix2}[/tex]

    Having solved for Vix, it is a simple matter to find the required trajectory angle (note that for all angles except 45 degrees, there exists two trajectory angles to reach your target - provided nothing is in the way of one or both of the calculated trajectories):

    [tex]\alpha = cos^{-1}\left( \frac{V_{ix1}}{V_i} \right)[/tex]
    [tex]\alpha = cos^{-1}\left( \frac{V_{ix2}}{V_i} \right)[/tex]
  8. Mar 10, 2010 #7
    As an example, suppose your target lies 100m away at an angle (alpha) of 36.8699 degrees uphill. Also, suppose your projectile is an arrow with an initial speed of 75 m/s. You need to find the angle of trajectory (beta) needed in order to hit the target.

    So, we start with the following values:
    D = 100
    alpha = 36.8699
    Vi = 75

    First, we need to determine the horizontal and vertical offsets to our target:
    Dx = D x cos(alpha) = 100 x cos(36.8699) = 80
    Dy = D x sin(alpha) = 100 x sin(36.8699) = 60

    Now, we can find a, b, c, & d:

    [tex]a = D^2 = 100^2 = 10,000[/tex]
    [tex]b = 9.8 \times {D_x}^2 \times D_y - {D_x}^2 \times {V_i}^2 = -32,236,800[/tex]
    [tex]c = 24.01 \times {D_x}^4 = 983,449,600[/tex]

    [tex]d = \sqrt{b^2 - 4ac} = 31,620,773.080998[/tex]

    Solve for the 2 equations:

    [tex]{V_{ix1}}^2 = \frac{-b + d}{2a}[/tex] and

    [tex]{V_{ix2}}^2 = \frac {-b - d}{2a}[/tex]:

    [tex]{V_{ix1}}^2 = \frac{-b + d}{2a} \approx 3192.8787[/tex]


    [tex]{V_{ix2}}^2 = \frac {-b - d}{2a} \approx 30.8013[/tex]

    Take the square roots:

    [tex]V_{ix1} \approx 56.5056[/tex]


    [tex]V_{ix2} \approx 5.5499[/tex]

    Finally, determine the angles:

    [tex]\alpha_1 = \cos^{-1} \left( \frac{V_{ix1}}{Vi} \right) \approx 41.1136^\circ[/tex]


    [tex]\alpha_2 = \cos^{-1} \left( \frac{V_{ix2}}{Vi} \right) \approx 85.7563^\circ[/tex]
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Trajectory, equation
  1. An equation (Replies: 8)