Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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"));
     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());


Product Version: UE 4.18
attacl.png (811.7 kB)
logs.png (3.3 kB)
more ▼

asked Mar 05 '18 at 08:56 PM in C++ Programming

avatar image

151 4 11 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Mar 08 '18 at 11:24 PM

avatar image

151 4 11 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question