Trigonometry related to Archery

In summary, the person is trying to calculate the arc an arrow will make, the maximum height it will reach, and at what time (in milliseconds) it will hit the target. They are also trying to understand the equation more.
  • #1
MstWntd
7
0
Intro:
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.

Problem:
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, I am 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 :rolleyes:

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

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

I don't understand the sin2 thing, do we square the sin of q?

Thats all I have, any help is appricated.
 
Last edited:
Physics news on Phys.org
  • #2
Welcome to PF.

MstWntd said:
[tex]x(t) = (v_{0} cos q) t[/tex]
Correct.

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

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.

The above is supposed to give me the new X and Y values. I can't seem to work it properly.
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.

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

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

I don't understand the sin2 thing, do we square the sin of q?

Nope, it's taking the sine of (2*q). v02 is squared though.
 
  • #3
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:
vy = vy - gravity
To calculate where the arrow is
Code:
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:
arrowRot = ATAN( vy / vx )

This is SUPER easy to code, and just fiddle with your gravity constant until it "feels" right.
 
  • #4
Hi,

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 I am not entirely certain), hence I will be re-writing the code.

minger, I will look into 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!
 

FAQ: Trigonometry related to Archery

1. What is the purpose of using trigonometry in archery?

Trigonometry is used in archery to accurately predict the trajectory of an arrow and determine the angle and distance at which to aim. This helps archers hit their target with precision.

2. How is the Pythagorean Theorem applied in archery?

The Pythagorean Theorem is used in archery to calculate the hypotenuse of a right triangle, which represents the distance between the archer and the target. This helps in determining the correct angle to aim and the amount of force needed to hit the target.

3. How does sine, cosine, and tangent relate to archery?

Sine, cosine, and tangent are trigonometric functions that are used in archery to calculate angles and distances. Sine is used to calculate the vertical distance of the arrow, cosine is used to calculate the horizontal distance, and tangent is used to calculate the angle at which the arrow should be shot.

4. Can trigonometry be used in long-range archery?

Yes, trigonometry can be used in long-range archery to accurately calculate the trajectory of the arrow and determine the correct angle and force needed to hit the target. This becomes especially important when shooting at longer distances where factors such as wind resistance and gravity can significantly affect the arrow's path.

5. How does the archer's position and stance affect the use of trigonometry in archery?

The archer's position and stance can affect the use of trigonometry in archery by changing the angle and distance from the target. This can impact the calculations and adjustments needed to accurately hit the target. Therefore, it is important for archers to maintain a consistent position and stance to improve their accuracy.

Back
Top