Imagine I have a mesh that I have applied a material onto. This mesh is moving. It will move into a trigger volume. Once it does, how can I get the material that’s applied to it to change into another material I’ve made until it leaves the volume again? Like imagine a have a sun I’ve made, the volume is around it. When a planet is in it it will have a water mat I made. If the object is outside the volume, the water mat will turn into an ice/snow mat.
to accomplish this you will need to use the on begin and end overlap events. these two events will tell the script when to change the materials. the next thing you will need is a reference to the mesh you want to affect. below theres two examples based on the overlaps. in the first we get the overlapping actor, then cast to identify the actors class, then we get the mesh (sphere). The second example shows how you could work with components directly, in this case we get a overlapping component and identify the mesh type (mesh, static mesh, skeletal mesh). I don’t know of a mesh parent class so here i showed casting to specific mesh types (needs further study). anyway the last thing you need to do is to create a material instance and set the material.
in summary on overlap event → identify mesh → create material instance → set material.