# Changable material Blueprint on crosshair over?

**URL:** <https://forums.unrealengine.com/t/changable-material-blueprint-on-crosshair-over/396356>\
**Category:** Architectural and Design Visualization\
**Tags:** archviz, unreal-engine, architecture, UE4, question, Blueprint\
**Created:** [June 19, 2017, 8:51pm UTC](https://forums.unrealengine.com/t/changable-material-blueprint-on-crosshair-over/396356 "2017-06-19T20:51:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_de2eabbc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_de2eabbc](https://forums.unrealengine.com/u/anonymous_user_de2eabbc)\
**Post date:** [June 19, 2017, 8:51pm UTC](https://forums.unrealengine.com/t/changable-material-blueprint-on-crosshair-over/396356/1 "2017-06-19T20:51:26Z")

</div>

Hi guys, I’ve been using UE4 for archviz for about 2 weeks now, and so far ,im in love with it. But since i just started and still dont have good overview of how things should work i need you help. I would like to make a changeable material blueprint that should add to viewport widget with material options,and each of those options can be select if player crosshair hovers over it for coupe of seconds. To explain it a bit better, lets say i wanna change a material of the sofa, i placed i a rotating icon over it, that should signal to user that sofa material can be changed, and when crosshair is over it widget with material options will appear. PS. i have custom created crosshair widget isstead of regulal red crosshair and im working in FPS mode. 🙂

 ![190879-11.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/2/4724e71284251be9bb66f6bb827957ffaad7b778.png)

 ![190876-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/e/b/6ebb4a9e49b143913cbd30ffde086d6fe05afb59.png)

 ![190877-3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/3/9c36e67943cbb9397e0afda4e3f3fb9c20f94b83.png)

 ![190878-wg1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/a/94a35c838a5917260a609cbafc76a11cfed5a38d.png)

---

<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:** [June 20, 2017, 4:30am UTC](https://forums.unrealengine.com/t/changable-material-blueprint-on-crosshair-over/396356/2 "2017-06-20T04:30:04Z")

</div>

Do a `Line Trace` starting at the camera location, straight out. If it hits something use the `Hit Actor` and cast it to the actor type you want to interface with, then you can tell it, you are looking at it.

 ![190914-ue_answerpic10a.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/2/b62aaf0d099ec8b7b6397477a592e2d8b50d143e.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_de2eabbc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_de2eabbc](https://forums.unrealengine.com/u/anonymous_user_de2eabbc)\
**Post date:** [June 20, 2017, 8:20pm UTC](https://forums.unrealengine.com/t/changable-material-blueprint-on-crosshair-over/396356/3 "2017-06-20T20:20:40Z")

</div>

@BenVlodgi

Thanks for a reply but i guess this is over my current skill set. 😕 I tried adding line trace into my first person character blueprint but i cannot see trace appearing on the screen. Also im not sure not to call the object from another blueprint, or ignore all except the one i need?

 ![200950-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/9/d/09d2f606f955fff0e87da017ae5b30c17e557a9c.png)

---

<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:** [June 20, 2017, 8:29pm UTC](https://forums.unrealengine.com/t/changable-material-blueprint-on-crosshair-over/396356/4 "2017-06-20T20:29:00Z")

</div>

You won’t see the trace unless you move your character, because the trace is heading straight out of the camera.

Why are you using the `OnActorHit`. Instead cast that HitActor to the type of actor you are using for the furniture, then fire a `Custom Event` on that reference.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_de2eabbc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_de2eabbc](https://forums.unrealengine.com/u/anonymous_user_de2eabbc)\
**Post date:** [June 20, 2017, 10:58pm UTC](https://forums.unrealengine.com/t/changable-material-blueprint-on-crosshair-over/396356/5 "2017-06-20T22:58:12Z")

</div>

@BenVlodgi Thanks again. Im really new at this and it takes some time getting used to it. Said that, i still cannot get line trace to work 😕 I flowed line trace tutorial i found online, and in stead of calling a widget i tried to destroy the object but line trace didn’t do anything. What im doing wrong?

First Person Character Blueprint

 ![200966-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/d/a/4dab3f590425f368d81c192ddf152945dedd0353.png)

 ![200967-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/1/d/c1d2d369a8c3b751f2f1aa29695d79ee948f4f70.png)

Blueprint Interface

 ![200968-3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/3/d/e3dfd1191fa2737e7744b01e47f56ac869e49dc0.png)

Target Blueprint that should be destroyed / interacted with

 ![200969-4.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/3/f8327e58ac43d119fc82a7a16ef44d9e94173748.png)

---

<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:** [June 21, 2017, 1:29pm UTC](https://forums.unrealengine.com/t/changable-material-blueprint-on-crosshair-over/396356/6 "2017-06-21T13:29:35Z")

</div>

Everything seems good, are you calling the `ifLook` event on tick?

Have you tried to debug step through this code while looking at one of the meshes? I’d put the breakpoint on the second `Branch`.

If that doesn’t help, my contact info is at the top, [benvlodgi.github.io](https://benvlodgi.github.io/)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_de2eabbc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_de2eabbc](https://forums.unrealengine.com/u/anonymous_user_de2eabbc)\
**Post date:** [June 29, 2017, 10:06pm UTC](https://forums.unrealengine.com/t/changable-material-blueprint-on-crosshair-over/396356/7 "2017-06-29T22:06:14Z")

</div>

Hi BenVlodgi,  
I didnt call the ifLook, and im note sure where should i call it? In the target blueprint? Also im not sure how to call it, because if i use event thick and branch i need condition and if i plug ifLook after that, its needs target so i cannot compile blueprint. How should i do it right?
