Get just overlapped actor

Hello,

I have mesh whose material can be changed. A widget open when player overlap the mesh. However, material of all meshes with that blueprint change. I just want to change overlapped mesh. I need to change “get all actors of class”. How can I do that?

Thank you

Hi,

You need to create a Dynamic Material Instance from the material you want to use (using the CreateDynamicMaterialInstance node) and apply that to your mesh. You also want to save it to a variable and use that as the reference when modifying the material runtime. This should be done in the constructor (you can use it elsewhere as well tho).

I hope this helps you.

Sorry I don’t understand. I’m already can change the material. I want to change whole material so I think set Material is working correctly. However, now, all meshes materials change. I just need to do it for selected mesh.

That is why you need to create an instance of the material using the CreateMaterialInstance node. That will create an instance of the selected material, so if you apply that to your mesh and change it via the reference returned from the node it will only update the materials on the meshes that are using that instance.
I hope this makes more sense now.

I understand now. Do you mean like this? Where I’ll connect temp target?


I don’t know what Temp is, I suppose a StaticMesh?

The CreateDMI node gives you a reference to your created dynamic material instance. Get your StaticMesh reference, pull out a wire and search for SetMaterial. The material you want to set is your instance. As I mentioned, also save this reference to a variable, so you can use it to update the material (like SetVectorParamater or whatever). The point is that only the meshes that are using the MI will update their material when you change something.