# How Raycast on component in blueprint?

**URL:** <https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [January 30, 2015, 5:04am UTC](https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941 "2015-01-30T05:04:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![DcDenton](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DcDenton](https://forums.unrealengine.com/u/DcDenton)\
**Post date:** [January 30, 2015, 5:04am UTC](https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941/1 "2015-01-30T05:04:14Z")

</div>

Hello people. Me need help. When im interact with object via “Single line trace by channel”, How i can make what the Component in inside my Blueprint Actor (whom have many differents mesh object like a combination lock keyboard). Me need. When im interact with component begin Custom events.

---

<div class="post-metadata">

**Author:** ![Fen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fen/32/635651_2.png) [@Fen](https://forums.unrealengine.com/u/Fen)\
**Post date:** [January 30, 2015, 11:09am UTC](https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941/2 "2015-01-30T11:09:36Z")

</div>

Hello,  
Use the “hit component” output from “break hit result”, the one under “hit actor” like :

[https://docs.unrealengine.com/latest/images/Gameplay/HowTo/UseRaycasts/Blueprints/GHT2B\_10.jpg](https://docs.unrealengine.com/latest/images/Gameplay/HowTo/UseRaycasts/Blueprints/GHT2B_10.jpg)

from [https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseRaycasts/Blueprints/index.html](https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseRaycasts/Blueprints/index.html)

---

<div class="post-metadata">

**Author:** ![DcDenton](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DcDenton](https://forums.unrealengine.com/u/DcDenton)\
**Post date:** [January 31, 2015, 8:08am UTC](https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941/3 "2015-01-31T08:08:10Z")

</div>

This is not exactly what i need. Me need Begin special event on each component inside in Blueprint. Example: 1 button for start engine, 2 button for turn light on and etc.

---

<div class="post-metadata">

**Author:** ![Fen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fen/32/635651_2.png) [@Fen](https://forums.unrealengine.com/u/Fen)\
**Post date:** [January 31, 2015, 8:40am UTC](https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941/5 "2015-01-31T08:40:41Z")

</div>

Here is the working bp : Do a cast to your blueprint (from hit actor output) and from it set your events by comparing your result with your components by or branches or an array.  
 ![382c574401810ab1cd7818ed188ad286f683adfa.jpeg](https://d1ap1mz92jnks1.cloudfront.net/images/transparent.png)

---

<div class="post-metadata">

**Author:** ![DcDenton](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DcDenton](https://forums.unrealengine.com/u/DcDenton)\
**Post date:** [January 31, 2015, 8:57am UTC](https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941/6 "2015-01-31T08:57:08Z")

</div>

need something like [Dropbox - Скриншот 2015-01-31 18.54.12.png - Simplify your life](https://www.dropbox.com/s/4kqoumwoie1x6ic/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%202015-01-31%2018.54.12.png?dl=0)

---

<div class="post-metadata">

**Author:** ![Fen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fen/32/635651_2.png) [@Fen](https://forums.unrealengine.com/u/Fen)\
**Post date:** [January 31, 2015, 10:51am UTC](https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941/7 "2015-01-31T10:51:03Z")

</div>

With same system you can call events from your blueprint and even use event dispatchers or set bool variables used as conditions in your bp.

Edit : Instead of a loop, set an array with your components and use “contains” to have the index and use it to a switch where you can set your events.

---

<div class="post-metadata">

**Author:** ![DcDenton](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DcDenton](https://forums.unrealengine.com/u/DcDenton)\
**Post date:** [January 31, 2015, 1:31pm UTC](https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941/8 "2015-01-31T13:31:14Z")

</div>

You mean enum struct? And how use event dispatcher?

---

<div class="post-metadata">

**Author:** ![Fen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fen/32/635651_2.png) [@Fen](https://forums.unrealengine.com/u/Fen)\
**Post date:** [January 31, 2015, 3:01pm UTC](https://forums.unrealengine.com/t/how-raycast-on-component-in-blueprint/19941/9 "2015-01-31T15:01:30Z")

</div>

If you want activation on hit, why don’t you use event hit and the “my comp” output to activate the event you want or directly use the on component hit ? Can you hit a mesh without pointing at it ?  
If you really want a line trace, do a custom event in blueprint with primitive mesh as input and add it from “cast to” at the end of your linetrace, then use it in your blueprint to activate the event you want.  
You can for example, use a “find” to save index and use actor on click with a switch on int using the index and activating what you want.

Edit : About event dispatchers if you stay on first proposal : [Actor Communication | Unreal Engine Documentation](https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/BlueprintCommsUsage/index.html#eventdispatchers)
