sourcePosition | The initial postion of the path requested. |
targetPosition | The final position of the path requested. |
passableMask | A mask specifying which NavMesh layers can be passed when calculating a path. |
path | The resulting path. |
Calculate a path between two points and store the resulting path.
var mesh: NavMesh; var target: Transform; private var path: NavMeshPath; function Start () { mesh.CalculatePath(transform.position, target.position, -1, path); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { public NavMesh mesh; public Transform target; private NavMeshPath path; void Start() { mesh.CalculatePath(transform.position, target.position, -1, path); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): public mesh as NavMesh public target as Transform private path as NavMeshPath def Start() as void: mesh.CalculatePath(transform.position, target.position, -1, path)