Example #1
0
    private void OnDrawGizmos()
    {
        foreach (GizmoObject obj in gizmoObjects)
        {
            Gizmos.color = obj.color;
            if (obj is GizmoSphere)
            {
                GizmoSphere objSphere = (obj as GizmoSphere);
                Gizmos.DrawWireSphere(objSphere.pos, objSphere.radius);
            }
            else if (obj is GizmoCube)
            {
                GizmoCube objCube = (obj as GizmoCube);

                Matrix4x4 cubeMatrix = Matrix4x4.TRS(objCube.pos, Quaternion.Euler(objCube.rotation), objCube.scale);
                Matrix4x4 oldMatrix  = Gizmos.matrix;

                Gizmos.matrix *= cubeMatrix;
                Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
                Gizmos.matrix = oldMatrix;
            }
        }

        gizmoObjects.Clear();
    }
Example #2
0
    public void DrawSphere(Vector3 _pos, Color _color, float _radius)
    {
        GizmoSphere newGizmoSphere = new GizmoSphere(_pos, _color, _radius);

        gizmoObjects.Add(newGizmoSphere);
    }