location | 要在导航网格表面上移动的位置。 |
target | 您需要将代理移动到的世界位置。 |
areaMask | 位掩码,在与可遍历区域对应的索引处,值设置为 1,对于不应遍历的区域,值设置为 0。此参数可以忽略,在这种情况下,默认为 NavMesh.AllAreas。另请参阅:Areas and Costs。 |
NavMeshLocation
NavMesh 上的新位置,与指定 target
位置尽可能接近。
当起点位于 areaMask
不允许的区域内时,返回起点 /location/。
将导航网格位置移动到另一个位置,且不会与表面失去接触。
返回导航网格上最接近 target
位置的位置,并且通过允许的区域类型在导航网格表面建立持续连接,一直到 location
参数指定的起始位置。如果 target
位置位于表面边缘或其允许的区域之外,则返回位于边缘上的位置。
此移动不会跨越 NavMeshLinks 和 Off-mesh Links。
如果 NavMeshQuery 初始化中的 pathNodePoolSize
值不足以容纳需要遍历的所有节点以便在 location.position
和 target
之间找到连接,则结果可能不准确(最接近)。
另请参阅:NavMeshQuery.MoveLocations、NavMeshQuery.MoveLocationsInSameAreas。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.