言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

NavMeshAgent.GetLayerCost

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public function GetLayerCost(layer: int): float;
public float GetLayerCost(int layer);
public def GetLayerCost(layer as int) as float

Parameters

layer レイヤーのインデックス

Returns

float 指定されたレイヤーの現在のコスト

Description

特定のタイプの地面を横断するためのコストを取得します

経路コストとは、移動することに伴う "難易度" を表します。短い経路だからといって難易度の高い場合、例えば泥、雪、その他を横切る場合は最短時間の経路とはかぎりません。地形の種類は Unity 上では ナビメッシュレイヤーにより記されます。特定レイヤーのコストは距離あたりのコストで指定されます。経路コストは経路探索でのみ使用されることに留意して下さい。自動的にエージェントの移動速度に影響しないということです。経路コストは危険度(安全だが長い距離の地雷原を通る)あるいは表示可否(キャラクターが長い距離の間、影にいる)を示す場合もあります。