Unity Physics2D.OverlapPointAll

来源:互联网 发布:egd网络小黄金骗局 编辑:程序博客网 时间:2024/06/14 06:37

描述

此函数用于检测2D场景中某个位置(Vector2 point)处所有的碰撞体


返回值 

Collider2D[] :


参数  

point 被检测的场景中的点

layerMask 在指定的层中检查对象

minDepth 最小深度(z轴)

maxDepth 最大深度


案例

检测鼠标点击到哪些物体:

Collider2D[] col = Physics2D.OverlapPointAll(Camera.main.ScreenToWorldPoint(Input.mousePosition));

0 0