返回介绍

BuoyancyEffector2D.surfaceLevel 水平面

发布于 2019-12-18 15:37:27 字数 2510 浏览 876 评论 0 收藏 0

JavaScript => public var surfaceLevel: float;
C# => public float surfaceLevel;

Description 描述

Defines an arbitrary horizontal line that represents the fluid surface level.

定义任意表示流体水平面的水平线。

The Collider2D used by the effector only defines the overall area of effect for the buoyancy forces, but not the actual surface level of the fluid. Any 2D colliders that overlap this area of effect are then tested against the surface level. The surface level is a line which is used to determine if the Collider2D is submerged, not submerged or partially submerged. Anything below this line is submerged, anything above this line isn't submerged and anything overlapping this line is partially submerged.

使用效果器的Collider2D,仅定义了浮力作用的整体区域,单不是流体的实际水平面。任意2D碰撞器影响的重叠区域是针对水平面的测试,该水平面是一条用来确定是否Collider2D淹没、没淹没或部分淹没的线。任何在该线下的是被淹没,任何在该线上的没有淹没,任何重叠该线的是部分淹没。

The surface level is defined as a line that extends to infinity along the X-axis and can be configured to by in any position along the Y-axis i.e the surface can be increased or decreased along the Y-axis. In effect, the surface can be raised or lowered to produce filling or draining fluid effects or simply left at a fixed position.

该水平面定义一条线,沿X轴无限延伸,并由Y轴设置任何位置。例如,水平面可以沿Y轴上升或下降。实际上,该水平面可以提高或降低,以产生填充或排水的效果,或简单地固定一个位置。

Typical usage is to use a single effector and associated Collider2D, most likely a BoxCollider2D however you are not limited to this and can use any number or type of Collider2D to define the potential buoyancy area(s) but again, the actual surface level is defined by this property.

典型的用法是使用一个效果器和相关的Collider2D,可能是一个BoxCollider2D,然而不局限一个,可以使用任意数量或Collider2D类型来定义潜在的浮力区域,单同样,实际的水平面有该属性确定。

Rotating the GameObject will not cause the surface level to rotate as it is defined as a world-space line. This greatly simplifies the intersection calculations and keeps performance high.

旋转游戏对象不会导致水平面旋转,因为它被定义为世界空间的线。这大大简化了交叉计算并保持高性能。

The surface level scales with Transform scale in the Y-axis so you can set the surface level relative to effector colliders and it will keep its relative position when scaling.

水平面的缩放是根据变换缩放的Y轴,因此你可以设置相对于效果器碰撞器的水平面并当缩放时,保持它的相对位置。

See Also: Collider2D.usedByEffector.

BuoyancyEffector2D

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文