Unity3D 调试根据旋转画boxWire网格

Unity3D 调试根据旋转画boxWire网格_第1张图片


private void OnDrawGizmos()
{
    if (debug)
    {

        if (bCollider)
        {
            Gizmos.color = Color.red;
        }
        else
        {
            Gizmos.color = Color.yellow;
        }
        if (boxCollider)
        {
            var rotationMatrix = Matrix4x4.TRS(boxCollider.transform.position, boxCollider.transform.rotation, boxCollider.transform.lossyScale);
            Gizmos.matrix = rotationMatrix;
            Gizmos.DrawWireCube(boxCollider.transform.position - boxCollider.bounds.center, Vector3.one);
        }
    }
}

你可能感兴趣的:(unity3d)