# Line trace by multiple channels possible?

**URL:** <https://forums.unrealengine.com/t/line-trace-by-multiple-channels-possible/341610>\
**Category:** C++\
**Tags:** line-trace, unreal-engine, question\
**Created:** [December 16, 2015, 11:38am UTC](https://forums.unrealengine.com/t/line-trace-by-multiple-channels-possible/341610 "2015-12-16T11:38:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_c0687f281](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c0687f281](https://forums.unrealengine.com/u/anonymous_user_c0687f281)\
**Post date:** [December 16, 2015, 11:38am UTC](https://forums.unrealengine.com/t/line-trace-by-multiple-channels-possible/341610/1 "2015-12-16T11:38:54Z")

</div>

Hi there,

Is there any method to do a line trace by channel, but trace for more than one channel at once?

![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/4/df4ef4ac03374fbb30d3d7dd7f74e978fdd557a6.png)  
In my case I would like to trace for the (custom) channels _UIObject_ **AND** _UsableObject_. Any ideas?

Thank you!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_41845f4a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_41845f4a](https://forums.unrealengine.com/u/anonymous_user_41845f4a)\
**Post date:** [December 16, 2015, 6:37pm UTC](https://forums.unrealengine.com/t/line-trace-by-multiple-channels-possible/341610/2 "2015-12-16T18:37:56Z")

</div>

Hello ,

I’m not quite sure if there is something already built in to do this directly but the first question would be what you’re looking to do with it. Do you wish for the trace to pick up anything that is UIObject or UsableObject or does it need to be classified as both for the trace to pick it up?

---

<div class="post-metadata">

**Author:** ![mago314](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mago314](https://forums.unrealengine.com/u/mago314)\
**Post date:** [December 16, 2015, 7:03pm UTC](https://forums.unrealengine.com/t/line-trace-by-multiple-channels-possible/341610/3 "2015-12-16T19:03:28Z")

</div>

Try making 2 line traces, one after the another… I know it’s not exactly what you were expecting but this solution will work and is very performance cheap

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c0687f281](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c0687f281](https://forums.unrealengine.com/u/anonymous_user_c0687f281)\
**Post date:** [December 18, 2015, 11:01am UTC](https://forums.unrealengine.com/t/line-trace-by-multiple-channels-possible/341610/4 "2015-12-18T11:01:52Z")

</div>

Hi ,

it’s just to change the color of the crosshair, depending of the type of the object.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c0687f281](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c0687f281](https://forums.unrealengine.com/u/anonymous_user_c0687f281)\
**Post date:** [December 18, 2015, 11:02am UTC](https://forums.unrealengine.com/t/line-trace-by-multiple-channels-possible/341610/5 "2015-12-18T11:02:02Z")

</div>

Ok, thanks. I will try that.

---

<div class="post-metadata">

**Author:** ![True\_Beef](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@True\_Beef](https://forums.unrealengine.com/u/True_Beef)\
**Post date:** [January 25, 2025, 11:36pm UTC](https://forums.unrealengine.com/t/line-trace-by-multiple-channels-possible/341610/6 "2025-01-25T23:36:52Z")

</div>

> Try making 2 line traces, one after the another… I know it’s not exactly what you were expecting but this solution will work and is very performance cheap

The above ‘solution’ proposed does in fact work, but is _not_ the correct answer, nor the most performant. His answer implies doing more traces for each channel, but imagine you’ve got an enemy tracing 5 times for 5 channels every frame, and then you spawn twenty of those. That is now 100 trace queries _ **every frame.** _ That is a pretty heavy load on the CPU and only goes up exponentially if you wanted to query more than 5 channels per enemy.

Looks like you’re asking for a solution for blueprints, but I am mostly using C++. If anyone else finds this, the correct way to do this in C++ is using [SweepSingleByObjectType](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Engine/UWorld/SweepSingleByObjectType) and passing a FCollisionObjectQueryParams struct with added channels you wish to query like so:

```auto
FHitResult groundHitResult;
FVector traceStart = the start of your trace
FVector traceEnd = the end of your trace
FCollisionShape colShape = FCollisionShape::LineShape();	
	
FCollisionQueryParams traceParams;
FCollisionObjectQueryParams objParams;	

GetWorld()->SweepSingleByObjectType(groundHitResult, traceStart, traceEnd, FQuat::Identity, objParams, colShape, traceParams);

```

Seems like a blueprint method for this should already exist, i’d try looking around for it.
