Hi
Could any recommend, or point me towards, any tools/information for debugging LineTrace and why certain actors/components would be ignored?
In my current case, we have a pawn with Sphere components attached to it. I believe we have all the parameters set correctly on the sphere for it for collide, but its not, ie
- sphere->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
- sphere->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
etc
However when calling a BP Line Trace, no hit is being registered on the spheres (but it is on the pawn).
The Trace Channel on the BP node is set to Visibility.
This question is not so much how to fix my specific problem, but if there are any tools to help debug this, since from what I see the LineTrace ends up calling into external physics code so its not easy to step through to see how it decides to collide and why it skips certain things…
Ideally, I would like debug output similar to:
LineTrace from Point A to Point B intersected Component X but was ignored because TraceChannels don’t match, or something like that.
Or any other tips for debugging this.
PS: Ive turned on the debug draw lines, but this doesn’t help determining why something was NOT collided with.
Thanks!
Sounds like either a Collision Channel or the type of Line Trace you are doing. Can you show the blueprint of the trace?
Well, in this case its more looking for the best practice to debug why line traces are failing, as opposed to solving this specific problem.
Either way though, here is the Line Trace - its pretty straight forward. Ive confirmed that Actors to Ignore does not include the actor in question.

And here is the code to create the sphere component.
USphereComponent* myCollision = NewObject<USphereComponent>(GetOwner());
myCollision->SetSphereRadius(250);
myCollision->bGenerateOverlapEvents = true;
myCollision->IgnoreActorWhenMoving(GetOwner(), true);
myCollision->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
myCollision->SetCollisionObjectType(ECollisionChannel::ECC_Vehicle);
myCollision->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
myCollision->SetCollisionResponseToChannel(ECC_Pawn, ECR_Block);
myCollision->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Block);
myCollision->SetCollisionResponseToChannel(ECC_TwnBullet, ECR_Block);
myCollision->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
myCollision->SetPhysMaterialOverride(WheelPhysicalMaterial);
myCollision->SetCollisionProfileName(TEXT("My Sphere"));
// Added this afterwards, wasnt sure if it was required.
myCollision->SetSimulatePhysics(true);
myCollision->WakeRigidBody();
FName socketName = FName(TEXT("CollisionSocket")));
myCollision->AttachTo(mesh, socketName, EAttachLocation::KeepRelativeOffset);
It looks like the sphere just isn’t in the physics simulation. When I run “PXVIS collision”, the spheres are not visible. I’m currently looking into why its not being added (meaning this problem likely has nothing to do with the LineTrace itself).