- Home /
Ingame splat mapping
Hey guys, so I'm planning on creating a game where you have to run and paint your surroundings to progress. You can switch between various paints that when touching them enable you to e.g. jump higher than usual. But I don't know how I should implement the firing of the paint itself and how the actual painting of the meshes happen. Furthermore I don't really know how to then detect whether the player is touching a color (if doing it with a splat map and alpha channels). Does somebody have an idea? I'm relatively new to unity.
Answer by shrey150 · Jul 09, 2017 at 10:16 AM
The best way to go about something like this would be when firing, you spawn a GameObject with a Rigidbody and Collider and project it forwards. This can be a "blob" of paint. When it collides with a wall GameObject tagged with "paintable", you destroy the blob, set the paint property of the wall to the paint property that the blob had. The properties would be set in a script. Something like a WallScript
and BlobScript
that have variables that can either be predetermined (for the blob) or be changed (for the wall). You could have multiple blob prefabs for different colors and change those with a control.
For the painting effect, you'd probably spawn decals and changing the material of the wall. Either change material.color
or spawn in a colored "splat" decal where the blob hit the wall. That decal could be a texture that you make.
For the player moving only on certain colored floors/walls, you could set a variable in the player script for what they are currently allowed to travel on, then check the player's OnCollisionEnter
and trigger a Game Over if they collide with the wrong wall.
Additionally, you could have a game manager that keeps track of the current traversable color, then disable walls' colliders that don't have that color. It would be more effective if a player falls through the map than a simple Game Over screen xD
I hope this helped, tell me if you need help with any specifics, and good luck with your game!
Thank you! I found this video series by unity explaining what I need: https://unity3d.com/de/learn/tutorials/topics/scripting/introduction-and-session-goals?playlist=17117 . I'm just wondering how it might be possible to sort of let the splats "fuse".
Your answer
![](https://koobas.hobune.stream/wayback/20220612125830im_/https://answers.unity.com/themes/thub/images/avi.jpg)