Line trace does not shoot from the crosshai which is the centre of the screen, C++ ?

I even change the GetPawnViewLocation to Cameras location but still it does not shoot from the crosshair which is the center o the screen

Your TraceEnd needs to be

FVector TraceEnd = EyeLocation + ShotDirection * 10000;

Otherwise you’re calculating from the world origin, not from the camera.

1 Like