location | 要在导航网格表面上移动的位置。 |
target | 您需要将代理移动到的世界位置。 |
areaMask | 位掩码,在与可遍历区域对应的索引处,值设置为 1,对于不应遍历的区域,值设置为 0。此参数可以忽略,在这种情况下,默认为 NavMesh.AllAreas。另请参阅:Areas and Costs。 |
NavMeshLocation
A new location on the NavMesh placed as closely as possible to the specified target
position.
The start location
is returned when that start is inside an area which is not allowed by the areaMask
.
将导航网格位置移动到另一个位置,且不会与表面失去接触。
返回导航网格上最接近 target
位置的位置,并且通过允许的区域类型在导航网格表面建立持续连接,一直到 location
参数指定的起始位置。如果 target
位置位于表面边缘或其允许的区域之外,则返回位于边缘上的位置。
此移动不会跨越 NavMeshLinks 和 Off-mesh Links。
如果 NavMeshQuery 初始化中的 pathNodePoolSize
值不足以容纳需要遍历的所有节点以便在 location.position
和 target
之间找到连接,则结果可能不准确(最接近)。
另请参阅:NavMeshQuery.MoveLocations、NavMeshQuery.MoveLocationsInSameAreas。