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"

Multi line trace returning no hit results

Been trying to get ray trace to return every actor hit. I am using UShapeComponents for collision detection, I disable every channel on my meshes and activate them on the ShapeComponents instead. I am using ECR_Overlap but I am getting nothing hit. I tried making the ECC_ObstacleChannel block but it only returns one of the actors that get hit, not even the first (might depend how they get added to the scene). Any idea what is missing? Thanks.

 void IObstacleInterface::BeginObstacle()
     ShapeComponent = GetCollisionShape();

In the Tick event...

         TArray<FHitResult> ObstacleHitResults;
         ObstacleHitResults.Init(FHitResult(ForceInit), 3);
         FCollisionQueryParams ObstacleCollisionQueryParams = FCollisionQueryParams(FName(TEXT("Trace")), true, MeshComponent->GetAttachmentRootActor());
         ObstacleCollisionQueryParams.bTraceComplex = false;
         ObstacleCollisionQueryParams.bReturnFaceIndex = false;
         ObstacleCollisionQueryParams.bReturnPhysicalMaterial = false;
         FCollisionResponseParams CollisionResponseParams = FCollisionResponseParams(ECollisionResponse::ECR_Overlap);
         if (MeshComponent->GetWorld()->LineTraceMultiByChannel(ObstacleHitResults, Current + FVector(0, 0, 50), Target + FVector(0, 0, 50), ECC_ObstacleChannel, ObstacleCollisionQueryParams, CollisionResponseParams))
Product Version: UE 4.10
more ▼

asked Nov 16 '15 at 12:46 PM in C++ Programming

avatar image

6 1 5 7

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

1 answer: sort voted first

Okay, my problem was the if statement. It only returns true when something collided with is Blocking. So I just removed the if and always execute the loop after to process the collided actors.

more ▼

answered Nov 17 '15 at 01:15 AM

avatar image

6 1 5 7

avatar image salm Nov 05 '17 at 05:24 PM

This saved me alot of trouble, thanks.

avatar image MadeInAm3rica Aug 20 '18 at 09:02 AM

Wish I found this sooner!

(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