レベルのジオメトリ (地形) から NavMesh (ナビメッシュ) を作成することを NavMesh Baking と呼びます。このプロセスは、Navigation Static としてマークされているすべてのゲームオブジェクトのレンダーメッシュと Terrains (地形) を収集し、それらを処理して、レベルの歩行可能な表面にほぼ等しいナビゲーションメッシュを作成します。
Unityでは、NavMesh (ナビメッシュ) の生成は Navigation ウィンドウ (Window > AI > Navigation) で処理されます。
シーンに必要なナビメッシュの作成は、4つの簡単な手順で行えます。
生成されたナビメッシュは、シーン内では、Navigation ウィンドウが開いていて表示されている状態の時に、ステージのジオメトリ上を覆う青いオーバーレイとして表示されます。
上の図で気づくように、生成されたナビメッシュの歩行可能領域はやや小さめに表示されます。ナビメッシュは、エージェントの中心が移動できる領域を表します。概念的には、エージェントを縮小されたナビメッシュ上の点と見なすか、フルサイズのナビメッシュ上の円と見なすかは関係ありません。なぜなら、この 2 つは同じことだからです。しかし、点とみなす方がランタイムの効率が良く、デザイナーは半径を気にせずエージェントがすき間を通り抜けることができるかをすぐに知ることができます。
Another thing to keep in mind is that the NavMesh is an approximation of the walkable surface. This can be seen for example in the stairs which are represented as a flat surface, while the source surface has steps. This is done in order to keep the NavMesh data size small. The side effect of the approximation is that sometimes you will need to have a little extra space in your level geometry to allow the agent to pass through any tight spots.
ベーキングが完了すると、そのナビメッシュが属するシーンと同じ名前のフォルダー内にナビメッシュアセットファイルが作成されます。例えば、Assets フォルダー内にある First Level というシーンの場合、ナビメッシュの場所は Assets > First Level > NavMesh.asset になります。
Navigation ウィンドウ上でオブジェクトを 静的ゲームオブジェクト として作成する方法の他に、インスペクター上部の Static メニューも使用できます。Navigation ウィンドウが開かれていない時にはこれが便利です。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.