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!

Trigonometry related to Archery

  1. Nov 20, 2008 #1
    Hello, I have spent the last four or so days searching google and this forum and as rich as both are in information and helping. I have found it very hard to get anywhere.

    Basically I haven't done any Maths/Physics related courses and as a result I am totally stumpped on my Games Technology Coursework.

    I am building a 3D game in C++ using OpenGL. I use a Bow and Arrow in this game.

    I need to calculate the arc the Arrow will make, the maximum height it will reach, at what time (in milliseconds) it will hit the target.

    By arc I mean, I would need to calculate its new X, Y and maybe X Rotation over the time its traveling.
    So then I can render the Arrow in its new coorodinates, thus giving it the apperence of flight.

    I hope I am making sense!

    Attempted Solutions:
    Suppose that the projectile starts at (0,0).
    Suppose that the initial velocity of the projectile is v0.
    X is the horizontal direction, and Y is the vertical direction.
    Then, the distance in the x and y direction over time t is:

    [tex]x(t) = (v_{0} cos q) t[/tex]

    [tex]y(t) = (v_{0} sin q) t – (gt^{2})/2[/tex]

    The above is supposed to give me the new X and Y values. I can't seem to work it properly.
    Either the equation is wrong or my Game World has warped coordinates, Im so ill-experienced I can't even tell!

    It might help if I understood the equation more. Also the course head will be checking our physics "engine" tommrow :uhh:

    I have an equation for the Maximum height as well..

    [tex]Maximum Height = (v_{0}2 sin2 q )/ (2g)[/tex]

    I dont understand the sin2 thing, do we square the sin of q?

    Thats all I have, any help is appricated.
    Last edited: Nov 20, 2008
  2. jcsd
  3. Nov 20, 2008 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    Welcome to PF.


    Okay, I see you did include a "-" in there, but it's not displaying properly:
    [tex]y(t) = (v_{0} sin q) t - (gt^{2})/2[/tex]
    is correct.

    One thing you may not be aware of, most programming languages assume "radians" units for angles when they do trig functions. Are your q's in degrees or radians?

    If that's not the problem, can you give some sample values for t, x, y, q, v0, and g? Then we can try to figure out why you're getting the wrong answer even though the equations are correct.

    Nope, it's taking the sine of (2*q). v02 is squared though.
  4. Nov 20, 2008 #3


    User Avatar
    Science Advisor

    I've written some flash games back in the day, and I find that typically it's much easier to pseudo-simulate real-world physics and you can obtain much easier results.

    For example, your starting arrow velocity will remain constant. Better yet, you can give it some function of string tension, or "power". Now, let the user choose an angle.

    Now, the x-component of your velocity will simply be [tex]v_x = V_{max}cos(\theta)[/tex] and the y-component [tex]v_y = V_{max}sin(\theta)[/tex]. You keep your x-component to the velocity constant. At this point you will neglect air resistance, so don't worry about it.

    Now, you will simulate gravity by subtracting a certain amount from the y-velocity. So, each frame, just:
    Code (Text):

    vy = vy - gravity
    To calculate where the arrow is
    Code (Text):

    x = x + vx
    y = y + vy
    Since the game will 3D, you can use z as the vertical direction, and x/y for directionality. To keep track of the arrow "rotation" just use the angle that the components of the velocity make with the ground. e.g.
    Code (Text):

    arrowRot = ATAN( vy / vx )
    This is SUPER easy to code, and just fiddle with your gravity constant until it "feels" right.
  5. Nov 24, 2008 #4

    Sorry for the late reply and thank you for the help!

    On Friday before the 2nd submission, I found a few things I was doing wrong. One thing was that my gravity was a positive number, this meant my arc was present but the Arrow would never decent! There was also something to do with the initial volocity and how I increased it.

    But one thing is for certain, my Game World has improper fundamentals (ok im not entirely certain), hence I will be re-writing the code.

    minger, I will look in to your advice after the re-write, I haven't put ANYTHING in classes, its all glued together with gobal methods and public variables!

    One thing is note worthy, the Arrow DOES behave correctly on occasion, but only with certain numbers. If all else fails then I'll trouble you guys with some sample numbers and see where we get.

    Thank you both, wish me luck!
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Trigonometry related to Archery
  1. Archery Problem (Replies: 2)