Hello guys, if I make a raycast like this:
FHitResult* HitResult = new FHitResult();
FVector StartTrace = FirstPersonCameraComponent->GetComponentLocation();
FVector ForwardVector = FirstPersonCameraComponent->GetForwardVector();
FVector EndTrace = ((ForwardVector * 5000.0f) + StartTrace);
FCollisionQueryParams* TraceParams = new FCollisionQueryParams();
if (GetWorld()->LineTraceSingleByChannel(*HitResult, StartTrace, EndTrace, ECC_Visibility, *TraceParams))
DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor::Green, false, 5.f);
It of course works, but it is not 100% accurate. It gets a little bit up and to the left. Most of the time its fine, but if I wanna shot something particularly small, it does not hit. Can I make it more accurate somehow?