获取四点+中心位置
今天需要计算一个collider的四个顶点位置以及通过collider内置变量获取sprite中心点位置
1 | cCenter = _boxCollider2D.bounds.center; |
可以使用bounds来确定中心点+四个点的位置
1 | line.changePosition(5, new Vector3(cCenter.x - _boxCollider2D.offset.x, cCenter.y - _boxCollider2D.offset.y, 0f)); |
可以使用offset来确定中心点位置