定义表示流体水平面的任意水平线。
该特效器使用的 Collider2D 仅定义这些浮力的总效果范围,但不定义该流体的实际水平面。然后,针对该水平面测试与该效果范围重叠的任何 2D 碰撞体。该水平面是一条直线,用于确定 Collider2D 是否淹没、未淹没或部分淹没。任何低于这条线的物体均淹没,任何高于这条线的物体均未淹没,任何与这条线重叠的物体均部分淹没。
该水平面被定义为沿 X 轴延伸到无限远的直线,并且可被配置在沿 Y 轴的任何位置中,即该水平面可沿 Y 轴移动。实际上,可升高或降低该水平面,以产生加注或排出流体的效果,或者仅使其保持在固定位置。
典型用法是使用单个特效器和关联的 Collider2D,这很可能是 BoxCollider2D,但不会仅限于此,您可以使用任何数量或类型的 Collider2D 来定义可能的浮力区域,但实际水平面由该属性来定义。
旋转 GameObject 不会导致该水平面旋转,因为它被定义为世界空间中的一条线。这极大简化了交叉计算并保持高性能。
该水平面以 Y 轴上的 Transform 比例缩放,因此您可以设置相对于特效器碰撞体的水平面,在进行缩放时,它将保持其相对位置。
另请参阅:::Collider2D::usedByEffector。
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.