Physics Help Forum Video Game Bow and Arrow Mechanics

 Energy and Work Energy and Work Physics Help Forum

 Sep 11th 2017, 06: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 06:25 AM.
 Sep 11th 2017, 07:31 AM #2 Physics Team     Join Date: Jun 2010 Location: Naperville, IL USA Posts: 2,269 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 07:34 AM.
 Sep 11th 2017, 11:00 AM #3 Senior Member     Join Date: Jun 2016 Location: England Posts: 314 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/~

 Tags arrow, bow, game, mechanics, video

 Thread Tools Display Modes Linear Mode

 Similar Physics Forum Discussions Thread Thread Starter Forum Replies Last Post StudyMadeEasy Kinematics and Dynamics 0 Feb 10th 2017 12:16 AM SunShadow Kinematics and Dynamics 0 Nov 20th 2010 11:38 PM arbolis Physics 4 Sep 12th 2009 09:27 AM