ETraceTypeQuery being converted to the wrong ECollisionChannel during line trace

I’m using UKismetSystemLibrary::LineTraceSingle to perform line traces in C++. So far my preference for traces (unless I create a new channel for them) has been ECC_Visibility, which is supposed to correspond to TraceTypeQuery4.

Here’s a forum post that first taught me about ETraceTypeQuery.

I had no trouble with this in a previous project, but in my current one UEngineTypes::ConvertToCollisionChannel is converting TraceTypeQuery4 to ECC_WorldDynamic. Very strange. I haven’t changed any of the project’s collision settings whatsoever. Has anybody run into this before? I’m on UE 5.1.1.

As a follow-up, ECC_Visibility has been assigned to TraceTypeQuery1 in my current project. Again, this is confusing as the last project I made had ETraceTypeQuery values assigned exactly the way I’d learned…and that project was on UE 5.1.1 as well.

In the previous project, I’d created 2 custom object channels for specific purposes but even then…shouldn’t custom trace/object channels be assigned the higher ETraceTypeQuery values, while the lower values are reserved for the engine’s default channels?

I recon you already figured it out, but for anyone to know how ETraceTypeQuery and EObjectTypeQuery map here is piece of code to figure it out

	for (int32 i = 0; i < ETraceTypeQuery::TraceTypeQuery_MAX; ++i)
	{
		ETraceTypeQuery EnumValue = static_cast<ETraceTypeQuery>(i);
		FString EnumName = UEnum::GetValueAsString(EnumValue);
		FString ChannelName =  UEnum::GetValueAsString(UEngineTypes::ConvertToCollisionChannel(static_cast<ETraceTypeQuery>(i)));
		UE_LOG(LogTemp, Log, TEXT("ETraceTypeQuery Name: %s"), *EnumName);
		UE_LOG(LogTemp, Log, TEXT("Collision Channel Name: %s"), *ChannelName);
	}
	for (int32 i = 0; i < EObjectTypeQuery::ObjectTypeQuery_MAX; ++i)
	{
		EObjectTypeQuery EnumValue = static_cast<EObjectTypeQuery>(i);
		FString EnumName = UEnum::GetValueAsString(EnumValue);
		FString ChannelName = UEnum::GetValueAsString(UEngineTypes::ConvertToCollisionChannel(static_cast<EObjectTypeQuery>(i)));
		UE_LOG(LogTemp, Log, TEXT("EObjectTypeQuery Name: %s"), *EnumName);
		UE_LOG(LogTemp, Log, TEXT("Collision Channel Name: %s"), *ChannelName);
	}

Custom traces are defined in YourProject/Config/DefaultEngine.ini

+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="Blockable")

This code does not get custom channel name properly, it just gets ECC_GaneChannelXX

that is correct, you have to look into file DefaultEngine.ini to see how channels ECC_GameTraceChannelX map to your custom channels.

+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="Landscape")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="Blockable")

Reason why i provided given code is that to know how these ETraceTypeQuery map to ECC_GameTraceChannel, because I scrached my head for a while with theses channels and how they map