Using decals in your game
Decals are projected to a mesh, so you could use them for laser sight dots since it doesn’t change the mesh they’re projected on and can move. You can also use decals for when the player shoots a gun at a wall and bullet holes appear.
In this recipe, we will create a mesh and project the Godot icon onto it. We will make a wall and programmatically add the Godot icon to the wall so that you can add some bullet holes or spray paint tags, as a player could do in a game.
Getting ready
For this recipe, add a new 3D Scene by clicking the + button to the right of the Particles2D scene. Then, save the scene as Decals
.
You can also download the project from this book’s GitHub repository.
How to do it…
Let’s create a box mesh and project the Godot icon onto it so that you can use it for shadows or to add details to any background mesh:
- Add a Decal node to the scene. Then, click Textures in the Inspector area...