Logging Collisions with our Ray Casting

FVector LineTraceEnd = PlayerViewPointLocation + PlayerViewPointRotation.Vector() * Reach;
private:
float Reach = 100.f;
GetWorld()->LineTraceSingleByObjectType(
Hit,
PlayerViewPointLocation,
LineTraceEnd,
FCollisionObjectQueryParams(ECollisionChannel::ECC_PhysicsBody),
LineTraceParams
);
FHitResult Hit;
FCollisionQueryParams
(
FName InTraceTag,
bool bInTraceComplex,
const AActor * InIgnoreActor
)
FCollisionQueryParams LineTraceParams(FName(TEXT("")), false, GetOwner());
AActor* ActorThatWasHit = Hit.GetActor();
if (ActorThatWasHit)
{
UE_LOG(LogTemp, Warning, TEXT("Line Trace has hit: %s"), * (ActorThatWasHit->GetName()))
}
Line Trace has hit : Cylinder_2

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store