Could anyone possibly help me out with a feature i’m trying to implement into a small prototype i’m making?
I’m trying to make a feature which only allows the pick up of the same colored ball as the player.
Essentially meaning if the color of the pick up does not match the color of the player, then the player dies.
Does anyone know how I could implement this?
Here is what I’m trying to do, if the material slot name is NOT equal to the static mesh, then destroy actor, otherwise collect pickup and add a point.
In general, visuals and logic should be separated. I’d make a variable on the player character that tells me if this player is supposed to pick up red or green cubes (or whatever). The object you pick up should have a variable as well that tells which color this object is. As I said, ignore what the material is. When you overlap, you can compare the object’s color to the player’s “target color”. You can use an enum so that it is easy to extend the system.
what about adding an interface to the balls you want to pickup and do a for loop on the overlap to check if they use that interface and do something if they do or dont.