Challenge My Way

The version I came up with. Doing it this way you don’t get the actor till you actually hit something.

FHitResult Hit;

FCollisionQueryParams TraceParameters(TEXT(""), false, GetOwner());

bool HittingSomething = GetWorld()->LineTraceSingleByObjectType(
	OUT Hit,
	PlayerViewPointLocation,
	LineTraceEnd,
	FCollisionObjectQueryParams(ECollisionChannel::ECC_PhysicsBody),
	TraceParameters
);

if (HittingSomething)
{
	UE_LOG(LogTemp, Warning, TEXT("Grabber Report Hit: %s"),
		*Hit.GetActor()->GetName()
	);
}

Justin

Privacy & Terms