此障碍物是否应该切断导航网格。
启用此属性后,系统会通过切孔来更改导航网格。孔的形状取决于 NavMeshObstacle 上设置的大小和形状,以及半径和高度方面的导航网格烘焙设置。
当障碍物移动时,雕刻孔也会移动,但为了减少 CPU 开销,仅在必要时重新计算孔。重新计算逻辑包括两个选项:1) 静止时雕刻;2) 移动时雕刻。
“静止时雕刻”是默认行为,且会在 carveOnlyStationary 设置为 true 时使用。当障碍物的移动距离超过 carvingMoveThreshold 设定的距离时,系统会将其视为移动,并移除雕刻孔。当障碍物停止移动且静止时间超过 carvingTimeToStationary 秒后,系统会将障碍物视为静止并再次更新雕刻。当障碍物移动时,agent 将通过避免碰撞的功能避开障碍物,但不会围绕障碍物规划路径。这种模式在性能方面通常是最佳选择。如果游戏对象由物理对象(即板条箱和木桶)控制,那么它是很好的搭配模式。
将 carveOnlyStationary 设置为 false 时,会出现“移动时雕刻”行为。在这种模式下,当障碍物的移动距离超过 carvingMoveThreshold 设定的距离时,雕刻孔便会更新。此模式非常适合缓慢移动的大型障碍物,例如步兵避开的坦克。
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.