Download

How do I implement projectile based FPS shooting the "right" way?

So I am trying to make an FPS project (for the first time) and I am having a bit of problem figuring out the “correct” way of implementing shooting with a projectile based system, or to be more specific, making the projectile shooting as accurate as possible while still having the projectile fire out of the guns muzzle (visually).

If I spawn a projectile at the guns muzzle than it won’t be accurate because the projectile won’t fly where I am aiming but if I spawn it in front of the player camera you will see the projectile pop out right in front of you instead of it firing out of the gun which looks weird I guess.

So what is the right method for implementing a projectile based shooting system (like for example Battlefield or PUBG)? Will the method be different if you include the ability to ADS (aim down sights)? Should you even be able to see the projectile fly through the air because fired bullets in real life are basically invisible to the human eye?

How do FPS games that have bullet drop normally do this?

Sorry for having so many questions but I am really confused right now.

Thanks!

I use the forward vector of the gun as the direction of the spawned bullet, spawn it at a socket at the tip of the barrel. bullets fly wherever the gun points. I suspect when you “spawn a projectile at the muzzle of the gun than it won’t be accurate because the projectile won’t fly where I am aiming” you are using the cameras forward vector? if so, then if the gun is pointing down, the bullet will still fire towards the rotation of the camera.

That’s not really what I meant. Maybe I wasn’t clear. What I meant was that if I fire the projectile from the muzzle of the gun then the projectile won’t fly towards the center of the crosshair. I want pixel perfect precision.

If I fire a sniper shot 500m away I don’t want the bullet to land next to my crosshair just because my sniper isn’t centered in the middle of the screen. If I aimed down the scope and my sniper was centered perfectly it still wouldn’t be accurate because my gun muzzle is slightly below the scope therefore the bullet will land slightly below the point where I anticipated it to land. So how do I have centered and pixel perfect accuracy with a projectile based system without spawning the projectile in the center of my camera view (in the crosshair).

I am probably terrible at explaining this but I hope you understand.

EDIT: Here is a video to explain what I mean https://www.youtube.com/watch?v=yVY6Nv4hY5k . This setup is for a third person shooter but I assume that it works for an FPS too… right?