Portal style gel gun

Hey, I was wondering if anyone had any suggestions on how I might go about creating a portal style gel gun. I’ve had a few thoughts as to how I might implement this. I’ve got my projectile spawning code working great, but I’m at a loss for how to actually make the paint splotches when they land.

I’ve thought of a few techniques, one being spawning a mesh where my paint blob hits the ground, and try my best to generate the mesh so it fits around all the different areas my gel blobs have touched a surface, but that sounds like it could be a nightmare.

I was also thinking that maybe RenderTextures could be used for something like this. I’m sure it would be great for actually showing the paint splotches on the surfaces that I paint, but how would I go about detecting weather or not my player or world objects are standing in that “painted area”?

Does anybody out there have any brilliant ideas?


I've never used it, but I think that Projectors does exactly that sort of thing, like blob shadows. Check it out.

Assuming everything you’d be able to splat with your gel gun has a mesh collider you could try using SetPixels to change a splatmap (or just a texture or alpha channel) within a given radius. Then, to detect if you’re on a particular surface you could use raycasting from your player combined with GetPixel. Game logic could then be modified according to the surface.

Alternatively you could use one of the decal systems that’s out there, or even make your own if you have the know-how. I know of at least one in the Unity Asset Store though. Finally, if you fancy going Berenger’s projector route then you could easily detect if you’re standing in gel by instantiating a trigger area wherever your projectile hits, as part of a prefab containing the projector. So long as you’re inside that trigger, your player can be influenced by whatever the gel does.