Go Back   Physics Help Forum > High School and Pre-University Physics Help > Energy and Work

Energy and Work Energy and Work Physics Help Forum

Reply
 
LinkBack Thread Tools Display Modes
Old Sep 11th 2017, 05:14 AM   #1
Junior Member
 
Join Date: Sep 2017
Posts: 1
Video Game Bow and Arrow Mechanics

I'm trying to implement bow and arrow mechanics in a game. Considering that I know two points on a grid, a launch angle, a velocity and the gravitational constant, how would I go about calculating an arrow's trajectory.

Additionally, how would I go about calculating the arrow's angle along every point of it's trajectory arc?

EDIT: I meant to post this in the kinematics sub-forum. Would be much obliged to the mods if this got moved to the appropriate place. Apologies for the hassle

Thank you.

Last edited by Wretch11; Sep 11th 2017 at 05:25 AM.
Wretch11 is offline   Reply With Quote
Old Sep 11th 2017, 06:31 AM   #2
Physics Team
 
ChipB's Avatar
 
Join Date: Jun 2010
Location: Naperville, IL USA
Posts: 2,261
I assume what you mean by "trajectory" is you need formulas for x- and y-coordinates as functions of time, and same with the angle, correct?

If we ignore air resistance, then given initial velocity V_0, the horizontal velocity is $\displaystyle v_x = V_0 \cos (\theta )$, where $\displaystyle \theta$ is the launch angle. Notice that this is constant. The vertical velocity changes with time as gravity causes the arrow to decelerate, and is $\displaystyle v_y = V_0 \sin (\theta )- gt$ where g is the acceleration dues to gravity: $\displaystyle g = 9.81 \frac m {s^2}$. If the (x,y) coordinate of the launch point is $\displaystyle (X_0,Y_0)$, then the x- and y-positions as a function of time are:

$\displaystyle x(t) = X_0 + V_0 \cos (\theta) t$
$\displaystyle y(t) = Y_0 + V_0 \sin(\theta) t - \frac 1 2 g t^2$

The angle of the arrow to the ground is equal to the arc tangent of the vertical velocity divided by the horizontal velocity (this assumes that the arrow always points in the direction of travel, which is not absolutely correct, but should be close enough for your purposes):

$\displaystyle \alpha = \tan^{-1} ( \frac {v_y}{v_x} ) = \tan^{-1} ( \frac {V_0 \sin (\theta )- gt}{V_0 \cos (\theta)} )$

Last edited by ChipB; Sep 11th 2017 at 06:34 AM.
ChipB is offline   Reply With Quote
Old Sep 11th 2017, 10:00 AM   #3
Senior Member
 
Woody's Avatar
 
Join Date: Jun 2016
Location: England
Posts: 246
How accurate do you need to be?

If you require greater accuracy, or are "shooting" long distances, then the aerodynamic drag on the arrow might become important.

Do you want to include wind effects?

If all you require is that it "looks" correct, then some approximations can be made (which will allow quicker computation).
Most games adopt approximations, which will be completely un-noticeable in normal game usage, trading absolute accuracy for improved frame rates.
__________________
~\o/~
Woody is offline   Reply With Quote
Reply

  Physics Help Forum > High School and Pre-University Physics Help > Energy and Work

Tags
arrow, bow, game, mechanics, video



Thread Tools
Display Modes


Similar Physics Forum Discussions
Thread Thread Starter Forum Replies Last Post
Watch the video on Kinematics StudyMadeEasy Kinematics and Dynamics 0 Feb 9th 2017 11:16 PM
How To Compute Y Velocity For A Projectile - Emulating an online Disney game SunShadow Kinematics and Dynamics 0 Nov 20th 2010 10:38 PM
Maccone's viewpoint on the arrow of time arbolis Physics 4 Sep 12th 2009 08:27 AM


Facebook Twitter Google+ RSS Feed