Doing this actually requires TWO traces.
The reason is because the crosshair is not in a 3D space, it’s in a 2D space, its coordinates only exist in 2D space. What the crosshair is “looking at” is dependent on how far away it is from the screen; you have to project the 2D screen coordinates forward until you hit an object which can be “looked at” to get the 3D location of that object.
What you need to do is trace outward from the center of your screen for some extremely long distance (say 15% or so further than the trace you’ll do for firing your gun, to account for the angle introduced by the camera) and then that hit point will determine “what I am aiming at”. This, incidentally, is how many games do it; you’d be surprised how many TPS games simply fire outward from center screen, rather than from the gun/player character itself.
If you want to instead trace from the gun barrel to the center of the screen (so that the player’s shots can be obstructed by walls or other obstacles that are between him and the target, even though the offset camera can see past them), you need to FIRST trace from the center of the screen outward, then perform a SECOND trace from the gun barrel location to the hit location of the first trace.
I do something similar in my game (though instead of a second trace, I launch a projectile from the gun barrel toward the “looking at” location using the LookAtRotation function). Here’s a screenshot of the set-up.
Note that I get the screen size and divide it in half across both dimensions to get “center screen”, which is my reticle position. Then I convert the screen space to a 3D vector, which takes “center screen” and tells me where it exists in the world (based on the camera position), and then projects outward to determine what the reticle is laying on. If you use a different aiming system than standard TPS (for example, a freed cursor which is not locked exactly to center screen) you could do something similar by taking the cursor position, BUT REMEMBER! The 3D world position has a horizontal and vertical position, and its depth is equal to the CAMERA! The game is trying to trace to a place on the camera itself, not what that camera sees. If the camera is behind the player, as in your project, tracing from the player actor to a camera position will trace backward to the camera itself. This appears to be what your project is doing; spawning traces that run from the player back toward the camera and hit where the camera is.
Also note that I spawn an actor with projectile movement; where I spawn my bullet, you would instead perform a second trace, with the start location being your player (or gun barrel socket, whatever) and the end location being THE HIT RESULT OF YOUR FIRST TRACE.