Gridmaps are a tool for creating 3D
game levels, similar to the way TileMap
works in 2D. You start with a predefined collection of 3D meshes (a
MeshLibrary) that can be placed on a grid,
as if you were building a level with an unlimited amount of Lego blocks.

Collisions and navigation can also be added to the meshes, just like you
would do with the tiles of a tilemap.

To begin, you need a MeshLibrary, which is a collection
of individual meshes that can be used in the gridmap. Open the “MeshLibrary_Source.tscn”
scene to see an example of how to set up the mesh library.

As you can see, this scene has a Spatial node as its root, and
a number of MeshInstance node children.

If you don’t need any physics in your scene, then you’re done. However, in most
cases you’ll want to assign collision bodies to the meshes.

You can manually assign a StaticBody and
CollisionShape to each mesh. Alternatively, you can use the “Mesh” menu
to automatically create the collision body based on the mesh data.

Note that a “Convex” collision body will work better for simple meshes. For more
complex shapes, select “Create Trimesh Static Body”. Once each mesh has
a physics body and collision shape assigned, your mesh library is ready to
be used.