distances | 包围距离的数组。这些距离应按升序排序。 |
设置该组应计算的“距离带”的包围距离,以及有关应如何处理属于每个距离带的球体的选项。
每个距离值均表示“达到”该距离的带;数组 [10, 20, 30] 描述“从 0 到 10m”、“从 10m 到 20m”和“从 20m 到 30m”的距离带。
使用从参考点(由 CullingGroup.SetDistanceReferencePoint 设置)到该球体最近边缘的距离来计算球体所在的距离带。因此,覆盖多个距离带的球体将被视为在距参考点最近的距离带内。
除了强制使对象是否可见,您还可以使用距离带来驱动您对象中的细节级别更改。例如,您可以定义“从 0 到 40m”以及“从 40m 到 80m”的距离带,尽管您可以使两个距离带都正常应用遮挡和视锥体剔除,但您可以使用不太复杂的骨架为第二个距离带中的对象生成动画,或者使它们运行不太复杂的 AI 行为。
默认情况下,超出最终包围距离的任何球体都被隐式强制为不可见。为避免这种情况,您可以指定最终包围距离为 float.PositiveInfinity。
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.