1. Limited time only! Sign up for a free 30min personal 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!

Initial Velocity in Vector3 format - non equal height

  1. Jan 10, 2010 #1
    I have been toiling over this for the last three weeks. I am programming a tank to fire at a target. The target can be all over the landscape up, down left right. Currently I have the turret turn to face the target turning the problem into a 2d equation. So I need help finding the right equation for initial velocity to hit the target.

    Basically I am doing the following.

    tv = target.transform.position - transform.position; // This is a vector direction to my target
    var g = -9.8; // Gravity
    var r = Mathf.Abs(tv.z); // The range or x to my target
    var a = Mathf.Sin(90); /
    var v = Mathf.Sqrt((r * g ) / a); // Finally get my velocity and return it
    return v;

    I know these equations are wrong but I am having a hard time trying to figure out how to account for height differences, and get the correct initial velocity to fire the bullet to hit the target.

    Thank you for your help!
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted

Similar Discussions: Initial Velocity in Vector3 format - non equal height
  1. Initial velocity (Replies: 3)