Download

Creating a Color Change for 2 boxes as a Ball passes through them

I am trying to create a project where I have a moving ball in the air (like a particle) pass through 2 cubes. I want the first cube to change to red and the second to blue as the ball passes through it. I want the cubes to change back to the original color after the ball has passed through it (original color is grey). I am mostly trying to focus on interactions between the objects and the actor. I can’t seem to find any helpful videos on youtube trying to do this. If anyone has any helpful videos or similar projects with the action map, please post them below.

That’s a whole load of stuff actually. Does it actually have to be a particle? Do you want the particle to look a bit like a magic spell moving through the air, or is just a simple sphere moving linearly ok?

In any event, you need to write the cubes as blueprints. They will detect when they overlap with something else and change their material. When the overlap ends, they change the material back.

You need to use a Material Instance (https://www.youtube.com/watch?v=qus9WjHX4_4) on your cubes with color set as a parameter, then use overlap events to change this parameter to the specific color you need. Check this tutorial “Interactive material swap using blueprints” https://learn.unrealengine.com/course/2436526 they are doing similar thing - changing walls color when you click on a button, in your case you don’t need UI, just put code in OnOverlapBegin and OnOverlapEnd