Using gridmaps


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 class_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 export the library, click on Scene -> Convert To.. -> MeshLibrary.., and save it as a resource.


You can find an already exported MeshLibrary in the project named "MeshLibrary.tres".

Using GridMap

Create a new scene and add a GridMap node. Add the mesh library by dragging the resource file from the FileSystem dock and dropping it in the "Theme" property in the Inspector.


The "Cell/Size" property should be set to the size of your meshes. You can leave it at the default value for the demo. Set the "Center Y" property to "Off".

Now you can start designing the level by choosing a tile from the palette and placing it with Left-Click in the editor window. To remove a tile, use Shift+Right-click.

Click on the "GridMap" menu to see options and shortcuts. For example, pressing "S" rotates a tile around the y-axis.


Holding <Shift> and dragging with the left mouse button will draw a selection box. You can duplicate or clear the selected area using the respective menu options.


In the menu, you can also change the axis you're drawing on, as well as shift the drawing plane higher or lower on its axis.


Using GridMap in code

See class_GridMap for details on the node's methods and member variables.