Change material on mouse over

Hi guys, i’ve a simple question. I’m new on UE4, comming from Unity.

I’m trying to catch on mouse over on object with a specified tag, and when the object has the tag, i need to modify the current material to apply a fresnel.

A way to give a feedback to the player saying “Eyyy, this item is an interactable item”.

The question is: Can i change the current material and add a fresnel? or i need to make two material per object and change the material when mouse over ??

Sorry for my bad english and thanks for your time.

@LeonelMV Generally speaking, this is not the way to make the player aware the object is interact-able.

You will have to modify the material for each object you want to intact with! It’s certainly possible, but a very long way round. You could do it with 2 materials, you could do it with a material instance which has the fresnel setting in the instance.

A much easier way is to change the cursor on the HUD to let the player know the object is usable. The crucial components of this are:

  1. A line trace coming from the camera ( in blueprints you can tell which object the line trace has reached - line trace by channel )

  2. Setting up a BP interface. This sounds a bit daunting, but the is literally nothing to it ( have a look on youtube for blueprint interface ).

  3. In your BP, you can tell if the intersected object implements your interface using the node ‘implements interface’.

  4. You can put multiple objects you want to interact with ( that belong together ) in a BP as components. These components can have tags like ‘clickable’. Your BP code that checks the object implements the interface, can also check if the component is clickable, and chance the cursor accordingly.

There is a lot of ground to cover here, but I’ve given you some useful pointers that I spent literally months finding out about when I was learning…

Of course, you can do it any way you want. You could also use an ‘outline’ shader ( see Tron material on youtube ), to let the user know an object is ready. But this again requires messing with the material for each interact-able object…

Check this link:
If it doesn’t go with your needs then,
You can use a widget in the actor to say “Eyyy, this item is an interactable item” and control its visibility through mouse click events. Also you can use Change Material node with the mesh selected in the same event.