LineTraceSingleByChannel always returns true

Hi all. I’m attempting to determine whether a box is sitting in front of my character with a raycast. I’m currently doing so by calling LineTraceSingleByChannel in Tick. I have created a custom channel called “Pickupable” in the project settings, and set the box Object Type to this channel. However, when I run the game, LineTraceSingleByChannel returns true no matter how far the character is from the box, and no matter its orientation. I’ve added a debug line and the raycast appears where I’m expecting it. Why is the function behaving this way? Is the raycast colliding with the character itself, even though it’s on a different channel? I’m a newbie so there must be something fundamental I’m misunderstanding about the function. Any help would be appreciated.

Here is the tick function:

void APracticeCharacter::Tick(float DeltaTime)
FHitResult hitResult;
FVector start = GetActorLocation() - FVector(0.0f, 0.0f, 30.0f);
FVector end = start + 100.0 * GetActorForwardVector();
DrawDebugLine(GetWorld(), start, end, FColor(255, 0, 0), false, -1, 0, 5.0);

bool isHit = GetWorld()->LineTraceSingleByChannel(hitResult, start, end, ECollisionChannel::ECC_GameTraceChannel1);

if (isHit)
UE_LOG(LogTemp, Warning, TEXT("I hit a thing! "), *hitResult.Actor->GetName());

Quick update: From debugging it looks like the ray is hitting the character itself, which is weird since I didn’t set the character to the pickupable channel… I’ve shared the character’s collision settings in the picture.

I’ve replaced the function with LineTraceSingleByObjectType, and it works as I expect it to. Can someone explain what the channel means then?

you must ignore your self while raycasting.

FCollisionQueryParams Params;


bool isHit = GetWorld()->LineTraceSingleByChannel(hitResult, start, end, ECollisionChannel::ECC_GameTraceChannel1, Params);

Oh, well that’s a reasonable explanation. Thanks!