# Why does SweepSingleByChannel not work with a Box?

**URL:** <https://forums.unrealengine.com/t/why-does-sweepsinglebychannel-not-work-with-a-box/393240>\
**Category:** World Creation\
**Tags:** sweep, Trace, trace-channels, unreal-engine, Physics, Collision, question\
**Created:** [May 10, 2017, 3:02pm UTC](https://forums.unrealengine.com/t/why-does-sweepsinglebychannel-not-work-with-a-box/393240 "2017-05-10T15:02:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon68466198](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon68466198](https://forums.unrealengine.com/u/anon68466198)\
**Post date:** [May 10, 2017, 3:02pm UTC](https://forums.unrealengine.com/t/why-does-sweepsinglebychannel-not-work-with-a-box/393240/1 "2017-05-10T15:02:28Z")

</div>

FCollisionShape StructureCollision = StructureMesh-\>GetCollisionShape();

```
FHitResult Hit; 
    
FVector CollisionLocation;
CollisionLocation = GetActorLocation();
CollisionLocation.Z += StructureCollision.GetBox().Z;
    
bool bHasHit = GetWorld()->SweepSingleByChannel(Hit, CollisionLocation, CollisionLocation, FQuat::Identity, ECollisionChannel::ECC_GameTraceChannel2, StructureCollision); //<--
    
DrawDebugBox(GetWorld(), CollisionLocation, StructureCollision.GetExtent(), (bHasHit ? FColor::Green : FColor::Red), true, 5.f);

```

What I am expecting: When StructureMesh (Static Mesh) is overlapping with another actor in the scene that respons to the appropriate channel (and this code is called) the debug box should be green.

 ![137462-highresscreenshot00001.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/0/4/c048811b8214ea3237288b1408d53ac7bf0c5782.jpeg)

What happens instead: The debug box does not turn green and therefore no hit results are generated.  
But replacing

```
bool bHasHit = GetWorld()->SweepSingleByChannel(Hit, CollisionLocation, CollisionLocation, FQuat::Identity, ECollisionChannel::ECC_GameTraceChannel2, StructureCollision);

```

with

```
bool bHasHit = GetWorld()->SweepSingleByChannel(Hit, CollisionLocation, CollisionLocation, FQuat::Identity, ECollisionChannel::ECC_GameTraceChannel2, FCollisionShape::MakeSphere(300.f));

```

does lead to the debug color turning green.

 ![137461-highresscreenshot00002.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/e/afe8cdacb41cb182a7fe1c8e3da5a6220a3b128f.jpeg)

Note: Using FCollisionShape::MakeBox(300.f, 300.f, 300.f) doesn’t work either.

How can I fix this?

---

<div class="post-metadata">

**Author:** ![eyosido](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eyosido](https://forums.unrealengine.com/u/eyosido)\
**Post date:** [September 25, 2017, 8:45am UTC](https://forums.unrealengine.com/t/why-does-sweepsinglebychannel-not-work-with-a-box/393240/2 "2017-09-25T08:45:56Z")

</div>

I think box collision is working now (4.17), I have made some testing with foliage collision and it seems to be working.

---

<div class="post-metadata">

**Author:** ![anon68466198](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon68466198](https://forums.unrealengine.com/u/anon68466198)\
**Post date:** [September 25, 2017, 11:35pm UTC](https://forums.unrealengine.com/t/why-does-sweepsinglebychannel-not-work-with-a-box/393240/3 "2017-09-25T23:35:42Z")

</div>

I have used blueprint as a workaround for this. In 4.17. I haven’t encountered it so far.

---

<div class="post-metadata">

**Author:** ![NormalNomad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NormalNomad](https://forums.unrealengine.com/u/NormalNomad)\
**Post date:** [November 29, 2018, 11:34pm UTC](https://forums.unrealengine.com/t/why-does-sweepsinglebychannel-not-work-with-a-box/393240/4 "2018-11-29T23:34:19Z")

</div>

start and end location need to be different. add a small increment (0.001f) to the Z-axis on the start location, and then set that as the end. good luck

---

<div class="post-metadata">

**Author:** ![yarpoplar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yarpoplar](https://forums.unrealengine.com/u/yarpoplar)\
**Post date:** [August 15, 2019, 5:55am UTC](https://forums.unrealengine.com/t/why-does-sweepsinglebychannel-not-work-with-a-box/393240/5 "2019-08-15T05:55:01Z")

</div>

It actually worked for me

---

<div class="post-metadata">

**Author:** ![HiredIceSpecter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HiredIceSpecter](https://forums.unrealengine.com/u/HiredIceSpecter)\
**Post date:** [August 13, 2021, 1:15pm UTC](https://forums.unrealengine.com/t/why-does-sweepsinglebychannel-not-work-with-a-box/393240/6 "2021-08-13T13:15:47Z")

</div>

You are my savior. I have been trying to figure out for weeks, why sweep with box would not work.
