# How to combine Line Trace and Box Collision Overlap

**URL:** <https://forums.unrealengine.com/t/how-to-combine-line-trace-and-box-collision-overlap/402825>\
**Category:** Architectural and Design Visualization\
**Tags:** oncomponentbeginover, linetrace, archviz, unreal-engine, Blueprint, question\
**Created:** [August 25, 2017, 1:17pm UTC](https://forums.unrealengine.com/t/how-to-combine-line-trace-and-box-collision-overlap/402825 "2017-08-25T13:17:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirompower](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kirompower](https://forums.unrealengine.com/u/kirompower)\
**Post date:** [August 25, 2017, 1:17pm UTC](https://forums.unrealengine.com/t/how-to-combine-line-trace-and-box-collision-overlap/402825/1 "2017-08-25T13:17:40Z")

</div>

Hi Guys !  
This is my first project with Unreal and all goes more than well, but I’ve come to a point where I can’t find any resources or information to continue.

The situation is as it goes:

I have a set of lamps in an interior scene, so I made them to turn on and off by a key only if you look at the lamps ( LightTraceByChannel), so everything is great, but now I want to make the light trace or maybe the button input to work only when I am in a specific areas (near light switches of course ), tried adding a “OnComponentBeginOverlap” but it doesn’t seem to work or I am doing it wrong. (the highlighted in red nodes are the lamp custom event just for easier orientation)  
Any suggestions, and do please explain like to a 4 year old, this is my first Unreal project and I come from a 3d background only, no coding.

Here are a few screens showing my Lamp Blueprint (where my custom event is) and my Character Blueprint (where my Line Trace is)  
And a third screen just to show off the project on the left is Unreal, on the right is VRay 🙂

Thank you in advance !

 ![211088-screen-04.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/0/d/b0d185669435c4f4c2263fd583c735beb0ff0a43.jpeg)

 ![211089-screen-05.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/d/ead7c82515473fbb8fcaab7541684634c513d47b.jpeg)

 ![211090-screen-06.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/4/c/64caba464605afd6fcd9fa17380c1becfe240785.jpeg)

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [August 27, 2017, 11:45pm UTC](https://forums.unrealengine.com/t/how-to-combine-line-trace-and-box-collision-overlap/402825/2 "2017-08-27T23:45:47Z")

</div>

- Use the [Gate](https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/FlowControl/#gate) node.
- When you enter an area (as triggered by the collision), call `Open` on the gate.
- When you leave the area, call `Close` on the gate.
- When you try to use Toggle the lightswitch, call `Enter` on the gate.
- Have the Gate’s input call the toggle light switch event or function.
- You’ll want the Gate to `Start Closed` if you don’t start in the area.

---

<div class="post-metadata">

**Author:** ![kirompower](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kirompower](https://forums.unrealengine.com/u/kirompower)\
**Post date:** [August 28, 2017, 2:08pm UTC](https://forums.unrealengine.com/t/how-to-combine-line-trace-and-box-collision-overlap/402825/3 "2017-08-28T14:08:21Z")

</div>

Thank you Ben I really appreciate it !

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [August 29, 2017, 12:59am UTC](https://forums.unrealengine.com/t/how-to-combine-line-trace-and-box-collision-overlap/402825/4 "2017-08-29T00:59:06Z")

</div>

Glad it worked for you!
