Similar Color Hiding Mechanic

So, I was thinking of implementing a sort of ‘hiding’ mechanic where if the player is a certain color (either their armor, or body, or w/e, doesn’t really matter) and that color is similar enough to the color of whatever they are near (and they DO have to be near the objects they want to be hiding amongst), or similar enough to a majority of the objects they are near, a monster looking in the direction of the player greater than a certain distance, won’t notice/attack the player (if the monster is close enough, they will notice the player anyway). Also, the player would have to not be moving. What would be the best way of implementing this type of mechanic? I was thinking either have traces extend from the player whenever they stop moving to check the color of objects near them to define if the player is ‘hidden’ or not, and have that ‘hidden’ automatically turn off when they start moving again. Or, maybe the traces would be coming from the monster. Would either of these ideas work? Even if they did, though, I don’t know how I would actually flesh them out in BPs. Any help with this would be much appreciated.

bump. Nothing from the unreal devs? Thought this would be something up their alley of nifty tricks/ideas they like to lay down on us. XD

I think doing it with the actual colors would be hard.


You could do it with variables and boxes or spheres.

You have a variable on your character holding the “color” he is right now… this could be a string, or an int or something, not an actual color.

Then you have your wall you want to hide at… it has a similar var… and on begin overlap you check to see if they have the same “color”. and if they do, you can pass that info to your AI script.

Spice this up with a material that goes transparent when there is a match and you could achieve a pretty cool effect.

First of all: Don’t bump after only waiting 20 minutes or so, it takes a couple of days to get good replies on here :wink:

As for the color mechanic, I can’t see an easy way to implement it. You can’t really return the color of a material by doing traces. You may however be able to trace out, get a material and then get the material parameters and figure out the colour that way, but obviously it won’t be the same for each pixel, and I’m not even sure if traces can do that alone, probably not without some extra help. Then, there’s the matter of perspective, you’ll have to figure out what direction the camera is in relation to the two objects camouflaging each other, and ensure you cast traces in the right direction.

Another method, is rather than use the materials, just give each blueprint a Variable ‘Colour’. You can find the object with a trace and get that variable, then determine if you should camouflage the object or not. That would require adding a variable to every object in the scene though, which will get a bit out of hand.

The only other thing I can think of is some kind of advanced edge-detection material, but no idea how to really implement that.

In short, it’s far from an easy thing to do. If you’re not sure how to flesh out any of these ideas in a Blueprint, I’d abandon it for now and come back to it at a later date. It’s an interesting idea nonetheless.

He waited 2 days bud :smiley:

Oh my bad… bloody American date system all being the wrong way around…