Version: 2022.3
言語: 日本語
オフメッシュリンクの作成
正確にキャラクタを配置するための Height Mesh ビルディング

Building OffMesh Links Automatically

Some use cases for OffMesh Links can be detected automatically. The two most common ones are: Drop-Down and Jump-Across.

  • Drop-Down リンクは、足場から落下させるために作成します。
  • Jump-Across リンクは、溝を飛び越えさせるために作成します。

In order to find the jump locations automatically, the build process walks along the edges of the NavMesh and checks if the landing location of the jump is on NavMesh. If the jump trajectory is unobstructed an OffMesh link is created.

Let’s set up automatic OffMesh Link generation. If you’re not familiar with NavMesh baking, take a look at Building a NavMesh.

First, the objects in the Scene where the jump can start from needs to be marked. This is done by checking Generate OffMesh Links in the Navigation (Obsolete) window under Objects tab.

次に、Drop-Down と Jump-Across の軌道を設定します。

  • Drop-Down リンクの生成は、 rop Height パラメーターで制御されます。このパラメーターは落下の高さの最高値を設定するもので、値を 0 にすると生成が行われなくなります。
    • Drop-Down リンクの軌道は、水平移動 (A)2*agentRadius + 4*voxelSize になるように定義されています。つまり落下後の着地点は、足場のふちを少しだけ外れた位置になっています。また垂直移動 (B) は、ベイク設定の Step Height よりも大きく_Drop Height_ よりも小さい値になっている必要があります。ボクセル化の過程で発生し得る丸め誤差によってリンクの生成が阻まれることのないよう、ボクセルサイズによる調整が行われます。Drop Height は、ステージ上で計測される値よりも若干大き目の値に設定すると、リンクが適切に接続されます。
  • Jump-Across リンクの生成は Jump Distance パラメーターで制御されます。このパラメーターは接続の最長距離を設定するものです。値を 0 にすると生成が行われなくなります。
    • Jump-Across リンクの軌道は、水平移動 (A)2*agentRadius よりも大きく Jump Distance よりも小さくなるように定義されています。また、着地点 (D) は、開始位置の高さから voxelSize 以上高くなってはいけません。

Now that objects are marked, and settings adjusted, it’s time to press Bake and you have will have automatically generated OffMesh links! When ever you change the scene and bake, the old links will be discarded and new links will be created based on the new scene.

トラブルシュート

Things to keep in mind if OffMesh links are not generated at locations where you expect them to be:

  • Drop Height はステージで実際に計測される距離よりも若干大きい値にする必要があります。そうすることで、ナビメッシュのベイク過程で発生する微小な偏差によってリンクの接続が阻まれるのを防ぐことができます。
  • Jump Distance はステージで実際に計測される距離よりも若干大きい値にする必要があります。Jump Distance は、ナビメッシュ上の特定の位置からもうひとつの位置までの距離です。つまり、確実に溝を越えるようにするには、2*agentRadius (プラスもう少し)を加える必要があります。

その他の参考資料

オフメッシュリンクの作成
正確にキャラクタを配置するための Height Mesh ビルディング