Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question What do games use for bullet drop?

Discussion in 'Physics' started by davebes123, Oct 8, 2022.

  1. davebes123


    Aug 25, 2021
    I'm not sure if this is the right place to ask this question.

    But for example with large-scale games like Battlefield or even just simple games that have implemented bullet drop, are they simply using raycasting that they'd adjusted or is there more to it?

    I have gone through many posts and videos on both unity forums and other websites in the past few days and it seems like everyone is stumped. I am not looking for any short cuts/answers but am genuinely curious on the approach.
  2. MelvMay


    Unity Technologies

    May 24, 2013
    That's fair enough but still, don't cross-post. I'll remove the other post from scripting because you're (presumably) not asking a scripting question.

    I had to look-up what you meant, still not sure. Best to explain in more detail what you mean rather than use terms you assume people understand. Presumably things moving under the influence of gravity. If that's the case, you've not asked what specific part of it you mean and exactly what information you need.
  3. davebes123


    Aug 25, 2021
    My bad.

    To try and add more detail, I have a small side project that is a FPS and the way I've implemented my weapon firing is that I have a raycast that will detect collision and then leave an impact mark/bullet hole in that specific spot. What I'm trying to do is add a "bullet drop" feature where after a certain range (I have my raycast set to 100f), the bullet begins to drop slowly until it hits the ground. So like for example a sniper rifle in most games after a certain range you will need to adjust your crosshair to make up for the bullet drop.

    I have seen posts about using gravity and checking the last position of the raycast to implement that feature but I wanted to know what kind of methods other people use.
  4. REDACT3D_


    Nov 8, 2020
    I would guess adding bullet drop functionality would also involve flight time mechanics.
    each game would have to handle that their own way depending if it's online or whatever.
    I imagine it would involve both raycasting to find the absolute straight line of sight in combination with some sort of physics along the traveled path to check to during the flight of any projectile.

    usually can't just run raw collision detection on a ridged body for objects that need to move faster then the bounds of the engine. gotta like fake it by checking for collisions in between frames.
    Anything faster then like a paintball is going to need extra checking to detect stuff.

    otherwise we could just do like Set Velocity = 1,600 and do checks with OnCollisionEnter
    but she move's too fast and will just phase right past objects. would be nice to do this because gravity and bounce reflections would be done already.

    if you want simulation resolution to your bullet drop, there's plenty of tables and math online to reference for mathematical equations.

    But I would imagine the hard part would be timing things like that for online play and hiding and lag
    Last edited: Oct 8, 2022