レベルのジオメトリ (地形) から NavMesh (ナビメッシュ) を作成することを NavMesh Baking と呼びます。このプロセスは、Navigation Static としてマークされているすべてのゲームオブジェクトのレンダーメッシュと Terrains (地形) を収集し、それらを処理して、レベルの歩行可能な表面にほぼ等しいナビゲーションメッシュを作成します。
Unityでは、ナビメッシュの生成は Navigation ウィンドウ (Window > AI > Navigation) で処理されます。
シーンに必要なナビメッシュの作成は、4つの簡単な手順で行えます。
生成されたナビメッシュは、シーン内では、Navigation ウィンドウが開いていて表示されている状態の時に、ステージのジオメトリ上を覆う青いオーバーレイとして表示されます。
上の図で気づくように、生成されたナビメッシュの歩行可能領域はやや小さめに表示されます。ナビメッシュは、エージェントの中心が移動できる領域を表します。概念的には、エージェントを縮小されたナビメッシュ上の点と見なすか、フルサイズのナビメッシュ上の円と見なすかは関係ありません。なぜなら、この 2 つは同じことだからです。しかし、点とみなす方がランタイムの効率が良く、デザイナーは半径を気にせずエージェントがすき間を通り抜けることができるかをすぐに知ることができます。
もうひとつ考慮に入れる必要があるのは、ナビメッシュはあくまでも歩行可能サーフェスを大まかに表したものだということです。例えば階段は、ソースのサーフェスにはきちんと段があったとしてもナビメッシュでは平らな傾斜面で表されたりします。これはナビメッシュのサイズを抑えるための仕様です。この副作用としては、ジオメトリに狭い場所がある場合、エージェントが通り抜けられるようにするためにスペースを少し余分に設ける必要が生じることがあります。
ベーキングが完了すると、そのナビメッシュが属するシーンと同じ名前のフォルダー内にナビメッシュアセットファイルが作成されます。例えば、Assets フォルダー内にある First Level というシーンの場合、ナビメッシュの場所は Assets > First Level > NavMesh.asset になります。
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.