Download

How can I cause an event to happen based on the material a object has?

So pretty much what I need to do is cause a specific color to burst if the correct color hits it. But then change after it hits something. For example, the blue ball hits a blue floor and gets a point but hits a green floor and does not…Now I understand I can create two different floors, one labeled green one blue but ill need my ball to change colors as well to allow the ball to then hit green and get a point and blue to not, etc… now I can create a whole new actor or ball for it to change into so it looks like it changed color but I don’t feel that’s efficient… Is there any way to create an event based on the color/material an object is? Hopefully that made sense ha.

@Carnage97 Easiest thing is to have an array of materials inside the floor and ball BPs ( you need to make them BPs ).

When the objects hit each other, all you have to do is compare array index. It’s much easier than comparing materials. We know intellectually we’re comparing materials, but don’t actually go down that route… ( makes very messy code ).

Yeah what @ClockworkOcean said. Keep it simple.
Create a BP for the ball.
Create a BP for the floor.
Each has a variable representing color. … String var, Name var whatever.

On collision (ball & floor) compare the two variables.
Ball -> get color, floor -> get color. If ball color == floor color ++points.

switch colors after you compare… dynamic material instance