Raycast doesn't shoot straight

Hello everybody!

I’m currently working on a third person shooter that uses raycasts for shooting, but the problem is, when i use character eye location and rotation for begin and end location (of course with a forward vector) the raycast is inaccurate on close range. If i use the camera rotation and location, the raycast is accurate on all ranges but i will be able to shoot over some obstacles while being crouched behind that obstacle. So i want the raycast to use the eye location and go to the centre of the screen. If i replace the location of the start point to the eyes and rotation stays to the camera, it will have the same problem as when Both are the eye view location. Does anyone have a solution for this?

Do you have a screenshot of your setup?

@T1Gijs I use the following to determine my projectile spawn transform. Works in first/third person and when aiming down sights.

Link to large: https://imgur.com/YGlel5D.jpg

The “Projectile Camera” is a function local var. I determine which camera is being used (I have several) and set that var on entry.