Procedural character aiming

I have a character (in 3rd person) aiming down the sight of their gun. I’m shooting projectiles straight out of the end of the gun, but it doesn’t match up with the crosshair.

What I’m trying to do is make it aim at the crosshair at any distance (at the hit point of a raycast, or the end of the ray if nothing is hit), so that whether you’re aiming at something near or far, the character will adjust their aim to always hit the center of the crosshair.

I’ve tried a few different things, such as having the right arm rotation (the left arm/gun/head follow this transform’s rotations) linked to an empty gameobject which looks at the correct point; I’ve also tried manually adding to the rotation through scripting but this is a far from ideal solution as it needs to be adjusted for every individual (aiming) animation present and seems to be rather inaccurate anyway.

I was wondering if anyone had any thoughts or experience on this. Perhaps (hopefully) I am overlooking something simple that I could do to resolve this.

Sounds to me that if your in a 3rd person perspective your not looking right down the barrel of the gun…This implies there is an angle between your line of sight and where the bullet is going…The cross hairs are likely stationary to your view and set a specific distance from your character. So mattering how far away and there relative position to you, your target would change the angle and where the cross hair would need to be placed to line up with the shot.

What this means is you would need to constantly calculate and move your crosshairs to correct the angle.

This is why shooters are 1st person perspective, it cuts out that angle and makes the line of sight line up with the line the bullets travel, and or at least minimizes it by keeping he angle on the y-axis and they make a sliht adjustment to the cross hairs position.

The other thing you could look at doing is pick a point in space where the crosshair/bullets will intersect. This would keep the cross hair fixed, and different guns could have different effective ranges. It would make it most accurate in specific situations and less in others.

Check out Unity’s 3rd person shooter example or the Bootcamp demo.