I am trying to print out the object that the player is looking at using the LineTraceSingleByObjectType function. However, nothing is printing.
Here is the code:
// Called every frame
void ACPP_BaseCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// Cursor Tracing
auto temp = UGameplayStatics::GetPlayerCameraManager(this, 0);
FCollisionObjectQueryParams ObjectParams;
ObjectParams.AddObjectTypesToQuery(ECollisionChannel::ECC_WorldDynamic);
FCollisionQueryParams Params;
Params.AddIgnoredActor(this);
GetWorld()->LineTraceSingleByObjectType(Looked, temp->GetCameraLocation(), temp->GetCameraLocation() + (GetActorForwardVector() * 500), ObjectParams, Params);
if(Looked.GetActor())
{
// add snapping to object
LookedActor = Looked.GetActor();
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Yellow, LookedActor->GetActorLabel());
}
}
Here is the collision presets I have: