It sounds like you understand the issue, and it’s pretty much the same as in real-life: when you aim a rifle, even a laser rifle, you are never going to be looking precisely down the bore, which is the actual axis of fire.
You have two lines, assuming no bullet drop:
- your eye line
- the bullet line
This means you either have:
- two parallel lines, introducing the offset you mention
- two converging lines that touch at the point of impact
BUT!!! for converging lines, the point of impact moves with the target distance… and anything in between you and the target could obscure one line and not the other.
Or you could fix the convergence point, which is how a rifle is trued out at a particular range.
There actually isn’t really a standard one-size-fits-all solution, just like real life. Aiming is as much an art as a skill.
Games fall into largely two camps:
- have the two lines actually offset by an amount (either the correct eye-to-gun amount or a smaller amount) and simply deal with you hitting obstacles with the bullet, or being able to fire around obstacles blocking your view
- just pretend the bullet came out of your eye and hits precisely where your gaze is.
And some games actually behave differently:
- at different ranges
- with different weapons
- based on if you are looking aim-down-sight or firing from the hip.
- if you are moving or stationary or prone or crouching
Some games might even do both simultaneously and take the one that gives you a hit, just to “be nice” since that makes for good game experiences.
Also, you don’t need a camera to raycast. You can raycast just from a Transform placed at the tip of your weapon, or obviously anything that gives you an origin: and direction: to cast from.
So in summary, kinda up to you as the game designer. 