Let’s imagine that you have a game where you can hit enemies with blunt weapons like a club or whatever another blunt weapon. So, now if player hits enemy with an any of these blunt weapons it should get blood on itself.
Is there any clever way to do this? Or is the only way just to check if the collision is with “enemyhead” collision box, do some blood particles and change material of a weapon to bloody, even though this means that you have to do bloody texture for every single weapon in game.
By clever way I mean something like a script that looks where blood particles are hit and then paints some blood texture there. Sorry if this sounds stupid, I’m not so sure yet of how particles work or if you can even do so with Free version or even with Pro.
I don’t like instantiating anything at runtime if I can help it, so here’s an alternative solution. Bear in mind it requires some understanding of Shader programming.
Use the alpha of the same weapon texture as a mask for what is “bloody”. Then just multiply it by red (optionally an input property) and blend that on top of your texture. This will optimize your shader by reducing texture lookups and memory usage (1 texture much better than 2 textures). It also simplifies and standardizes the “bloody” effect by making it just a mask for a color.
Now you just create 2 materials, one that uses the alpha like I described above, another that doesn’t. Swap them when you’re hit.
If you want to get fancy, you can just add a float property to your shader that scales the “bloody” effect on and off. Then you can do things like Fade it off and on, or even threshhold your “bloody” alpha mask (this could give the effect of blood expanding or contracting along the weapon).