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!

Projectile for a game

  1. Mar 8, 2005 #1
    I'm writing a video game. For the AI i need to be able to calculate the proper initial velocity for a given angle to hit a target a certain x,y distance away. I don't want to use time in the formula. Does any one know a formula for doing this? I found something about a "gunnery law" that looked similar to what i needed, but i couldn't find the formula. Any help would be appreciated since i'm a programmer and not much of a physics person. Thanks.
     
  2. jcsd
  3. Mar 8, 2005 #2

    Andrew Mason

    User Avatar
    Science Advisor
    Homework Helper

    If the target is at the same height as the launch, you can use:

    [tex]y= vsin\theta t - \frac{1}{2}gt^2[/tex]

    where: [tex]t = \frac{x}{vcos\theta}[/tex]

    If x = R (range) and y = 0, you have:

    [tex]vRtan\theta = \frac{gR^2}{v^2cos^2\theta}[/tex]

    [tex]v^3= \frac{gR}{tan\theta cos^2\theta}[/tex]

    [tex]v = \sqrt[3]{\frac{gR}{sin\theta cos\theta}}[/tex]

    AM
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?