AActor* APlayerController::GetActorUnderPoint(const FVector2D& point) const
{
FVector location, direction;
DeprojectScreenPositionToWorld(point.X, point.Y, location, direction);
FCollisionQueryParams TraceParams(FName(TEXT("")), true, this);
TraceParams.bReturnPhysicalMaterial = false;
TraceParams.bTraceComplex = false;
FHitResult hit(ForceInit);
float endOffset = 500;
FVector target = location + (direction * endOffset);
GetWorld()->LineTraceSingleByChannel(hit, location, target, ECC_GameTraceChannel1, TraceParams);
return hit.GetActor();
}