LineTraceMultiByChannel returning zero actors?

Hi Community,

I am currently testing out a weapon trace along a sword and for some reason it’s always returning zero hit actors when clearly the trace is going though an actor. Not sure what is going on here or how else to debug this. Any help is much appreciated.

Note that the spider has a capsule component and its collision presets are set to “Collision Enabled (Query and Physics”).

void AHeroCharacter::TraceWeapon()
{
	if (EquipedWeapon == nullptr)
	{
		UE_LOG(LogTemp, Warning, TEXT("Weapon is not equiped"));
		return;
	}

	UStaticMeshComponent* WeaponMesh = EquipedWeapon->GetMesh();

	FVector TraceStart = WeaponMesh->GetSocketLocation("TraceStart");
	FVector TraceEnd = WeaponMesh->GetSocketLocation("TraceEnd");

	FCollisionQueryParams TraceWeaponParams = FCollisionQueryParams(FName(TEXT("TraceWeaponParams")), true, this);
	TraceWeaponParams.bTraceComplex = true;
	TraceWeaponParams.bTraceAsyncScene = true;
	TraceWeaponParams.bReturnPhysicalMaterial = false;

	UE_LOG(LogTemp, Warning, TEXT("Tracing Weapon"));

	/** Debug */
	if (DebugFlags.DrawUsableLineTrace)
	{
		const FName TraceTag("TraceWeaponParams");
		GetWorld()->DebugDrawTraceTag = TraceTag;

		TraceWeaponParams.TraceTag = TraceTag;
	}
	/** End Debug  */

	TArray<FHitResult> HitResults;
	GetWorld()->LineTraceMultiByChannel(HitResults, TraceStart, TraceEnd, ECC_Visibility, TraceWeaponParams);

	UE_LOG(LogTemp, Warning, TEXT("We Hit %d Actors"), HitResults.Num());

232832-logs.png

I have solved the issue. I fixed the issue by changing the channel from ECC_Visibility to ECC_GameTraceChannel14. I am not sure why this solved my issue.