NavMeshAgent.SamplePathPosition(number areaMask, number maxDistance)
Sample a position along the current path.
Parameters:
Name | Type | Description |
---|---|---|
areaMask | number | A bitfield mask specifying which NavMesh areas can be passed when tracing the path. |
maxDistance | number | Terminate scanning the path at this distance. |
Returns:
type | Description |
---|---|
boolean | True if terminated before reaching the position at maxDistance, false otherwise. |
NavMeshHit | the properties of the resulting location. |
Usage
---@type NavMeshAgent
local navmeshagent;
---@type number
local areaMask;
---@type number
local maxDistance;
local val0, val1 = navmeshagent.SamplePathPosition(areaMask, maxDistance)
Extra Detail
This function looks ahead a specified distance along the current path. Details of the mesh at that position are then returned in a NavMeshHit object. This could be used, for example, to check the type of surface that lies ahead before the character gets there - a character could raise his gun above his head if he is about to wade through water, say.