Unity - A计划(永久有效期) 扫二维码继续学习 二维码时效为半小时

(196评价)
价格: 4019.00元

检测碰撞体是否位于绘制的圆(球)形区域内:isGrounded=Physics2D.OverlapCircle(groundCheck.transform,circleRadius,ground);

对该Physics2D的Api不够理解的,可以在Crawler的脚本中添加Unity事件函数,加深理解:

 private void OnDrawGizmos()
    {
        Gizmos.color = Color.grey;
        Gizmos.DrawWireSphere(groundCheck.transform.position, circleRadius);
    }

该事件会以groundCheck物体(爬虫的子物体)位置点为圆心,绘制一个与上述Physics2D.OverlapCircle(...)相同的圆(球)形区域,当爬虫移动到平台边缘时,可以直观地看到isGrounded何时=true或=false。

[展开全文]
VISI · 2022-12-31 · 0