Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Using Animation Curve to get the point where bullet hits?

Discussion in 'Scripting' started by TheOtherUserName, Aug 3, 2020.

  1. TheOtherUserName

    TheOtherUserName

    Joined:
    May 30, 2020
    Posts:
    48
    Hi so I recently looked for a sniper simulator and I didn't found any realistic ones so now I make my own. I often find graphs where you can see where the bullet hits at which zoom and the animation curve looks similar so I thought maybe I could use it my problem is I don't quite understand how it works so maybe someone could help?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    8,368
    A bullet in a vacuum travels in a parabolic path. In a fluid (air) the parabola is foreshortened by however much you want the air resistance to be.

    The downward force acting on the bullet is constant each frame (gravity).

    The braking force acting on the bullet is generally proportional to the bullet velocity (wind resistance).

    I'm not sure AnimationCurves enter into this at all.

    This is my Jetpack Kurt combat mode, which has distant-arcing-downwards bullets:



    Here's the script driving the above bullets:

    https://pastebin.com/PVKd7ASB
     
unityunity