Hi,
I have been trying to get a debug line trace to trace to the centre of the screen from the players’ eyes (for item pickup). I have found out where the debug line trace should start which is the camera component location. I also have the end point which is the camera location + the cameras forward vector * distance. I have checked and this should work. The problem is the debug line traces a bit above the crosshair on the screen. Am I just missing something or is the crosshair in the incorrect place? This is the code I am using for the debug trace (There is also a line trace for the actual functionality).
FVector RotVector = FirstPersonCameraComponent->GetForwardVector();
cameraLoc = FVector(PC->PlayerCameraManager->GetCameraLocation().X, PC->PlayerCameraManager->GetCameraLocation().Y, FirstPersonCameraComponent->GetComponentLocation().Z);
FVector startPlug = cameraLoc;
FVector endPlug = startPlug + (RotVector * 5000);
hit = GetWorld()->LineTraceSingleByChannel(result, startPlug, endPlug, ECC_WorldStatic, CollisonParams);
DrawDebugLine(GetWorld(), startPlug, endPlug, FColor(255, 0, 0), false, 2.0f);