version:Godot 4.0 beta 2 Addon.
OS: Windows, Linux
Create a Navigation2DRegion from the tiles painted on the TileMap node on the scene.
Godotのアドオンです。
シーン上のTileMapノードに塗ったタイルから、Navigation2DRegionを作成します。
Faultun-1490619614593941506-20220207_183305-vid1.mp4
This movie is 3.5 but same
In the scene view, when the TileMap node is selected, the commands are added at the bottom of the inspector.
Select "hole" in the generated NavigationRegion2D navpoly's polygon.
If there is already a node named "NavigationRegion2D", choose whether to overwrite it or add a new node without deleting it.
If you do not overwrite it, it will be added with a node name like "@NavigationRegion2D@24847".
Creates a margin from the wall. Specify the number of pixels.
This can be used when you want people to walk along the navigation, but do not want them to walk along the edge of the wall.
example 32 pixel tileset
gap 1 pixel
gap 4 pixel
gap 15 pixel
シーンで、TileMapノードを選択したときのインスペクタの一番下にこのような項目が追加されます。
選択しているTileMapノードのみを対象とするか、現在のシーンに存在するすべてのTileMapノードを対象とするか選択します。
生成されるNavigationRegion2Dのnavpolyのポリゴンの「穴」とするタイルを選択します。
すでに「NavigationRegion2D」という名前のノードがある場合に、上書きするか消さずに新規追加するか選択します。
消さない場合は「@NavigationRegion2D@24847」みたいな感じのノード名で追加されます。
壁から余白を作ります。ピクセル数を指定します。
ナビゲーションに沿って歩いてほしいが、壁きわきわに歩いてほしくないときに使えます。
32pixelタイルでの例
余白1pixel
余白4pixel
余白15pixel
GDExtensionのコードはこちら
(このアドオンにビルド済みのバイナリが含まれているので使う必要はありません)