Search code examples
unity-game-enginegame-physics

How and where should a bullet be instantiated in an FPS. Unity


Currently, when I shoot a bullet is instantiated at the muzzle of my gun. Then rotated to aim at a point x distance in front of the camera. I imagine this will result in a convergence effect as shots are fired further distances resulting in extremely offset aiming.

Surely this is not the correct way to instantiate bullets in an FPS so what is the standard?


Solution

  • You have two options:

    1. For very fast/instant shots- you should just check if the player "clicked" on the opponent (probably with a Raycast from the player's POV), without generating the actual shots (maybe generate something only for graphics), this way no room for mistakes in aim.
    2. For real bullets with calculated physics- the bullet should be instantiated from the POV of the player, even one step further (or displayed when far enough) so it won't appear too big on the player's screen. About aiming, now it won't have any offset since it shot from where the player sees the crosshair, not the actual gun. You can keep the shooting animation so it "feels" like it shot from the gun.