返回介绍

Physics2D.OverlapPointAll 重叠点所有

发布于 2019-12-18 15:38:17 字数 2411 浏览 1334 评论 0 收藏 0

JavaScript => static function OverlapPointAll(point: Vector2, layerMask: int = DefaultRaycastLayers, minDepth: float = -Mathf.Infinity, maxDepth: float = Mathf.Infinity): Collider2D[];
C# => static Collider2D[] OverlapPointAll(Vector2 point, int layerMask = DefaultRaycastLayers, float minDepth = -Mathf.Infinity, float maxDepth = Mathf.Infinity);

Parameters 参数

pointA point in world space.
一个世界空间中的点。
layerMaskFilter to detect Colliders only on certain layers.
只在某些层过滤检测碰撞器。
minDepthOnly include objects with a Z coordinate (depth) greater than this value.
只包括Z坐标(深度)大于这个值的对象。
maxDepthOnly include objects with a Z coordinate (depth) less than this value.
只包括Z坐标(深度)小于这个值的对象。

Description 描述

Get a list of all colliders that overlap a point in space.
得到一个列表,里面是所有与世界中的点重叠的碰撞器。

This function is similar to OverlapPoint except that all colliders that overlap the point are returned. The colliders in the returned array are sorted in order of increasing Z coordinate. An empty array is returned if there are no colliders over the point.
除了会返回所有与点重合的碰撞器,这个函数与OverlapPoint相似。碰撞器在返回的数组中会被用Z坐标排序。如果没有碰撞器与点重叠,就会返回一个空的数组。

Note that this function will allocate memory for the returned Collider2D array. You can use OverlapPointNonAlloc to avoid this overhead if you need to make the check frequently.
注意这个函数会分配内存给返回的Collider2D数组。在需要频繁做这个检测的时候,你可以使用OverlapPointNonAlloc这个函数去避免这些开销。

See Also: OverlapPoint, OverlapPointNonAlloc.

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

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

发布评论

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