How to color a target when being hit by a paintball

Use Case:

One of my minigames is a paintball FFA match, where the objective is to paint everyone else in your colors. You do so by shooting with your color-gun on players. I expect players to be able to over-paint previous hits from others. The target of the game is having the most color exposed after a certain amount of time (eg with 4 players 10% red, 15% green, 30% pink, 45% yellow).

However, since it’s just a minigame, I’m fine with less-than-ideal solutions. In my worst case solution, hit location is ignored completly (it’s much more random and less fun, because you wouldn’t have to try and hit the non-colored spots).

The question:

  • How do I paint a “color splash” on a actor upon being hit?
  • And how would I track the coloring? (remember, later hits may paint over previous hits with a different color)

My thoughts so far:

  • I thought that displaying the color could be done with decals, but those would probably paint a lot of undesired effects on everything around them. (e.g. when the hand was hit and the character holds his hand in front of his eyes, it would paint the head). Also, we are speaking of thousands of decals here. I’m also not sure how I would calculate the color distribution on the actor with this solution.
  • There was something called HitMask in UE3, couldn’t find it for UE4? I think this is what I would need to use?
  • Best possible solution of course would be if I somehow could add an color splash at the exact hit location onto the material and later extract how much of which color is on the material. However, I couldn’t find anything that would suggest that it’s possible.
  • Maybe I have to collect hit locations upon incoming hits in some data matrix and feed that data to the material? But then I can’t see how this would remotely be accurate, unless the actor’s mesh is a extremely simple object (cube).

Hello ,

What you would need to do is create a blueprint for your paintball, or whatever projectile you have firing. That projectile would look for whether or not it has come in contact with a mesh. Then you would have this projectile despawn. In addition to this blueprint you would also need another blueprint for your mesh that would detect the whether or not the projectile has collided with it. On this event you would spawn your decal. What you could do is give that decal a life of “X”’ and decide how long you want it to stay.

As for the paint over part of an existing decal you could have a detection of the vertices beneath where it spawns. This would allow for adding more decals in close proximity to others without despawning the first decals.

You sound like you are on the right track. I hope this helps give some more insight as to how you could handle this.