public static Vector3 GetVertex(this Bounds bounds, SA_VertexX x, SA_VertexY y, SA_VertexZ z) { Vector3 center = bounds.center; switch (x) { case SA_VertexX.Right: center.x -= bounds.extents.x; break; case SA_VertexX.Left: center.x += bounds.extents.x; break; } switch (y) { case SA_VertexY.Bottom: center.y -= bounds.extents.y; break; case SA_VertexY.Top: center.y += bounds.extents.y; break; } switch (z) { case SA_VertexZ.Back: center.z -= bounds.extents.z; break; case SA_VertexZ.Front: center.z += bounds.extents.z; break; } return(center); }
public static Vector3 GetVertex(this Transform t, SA_VertexX x, SA_VertexY y, SA_VertexZ z) { return(t.gameObject.GetVertex(x, y, z)); }
public static Vector3 GetVertex(this GameObject go, SA_VertexX x, SA_VertexY y, SA_VertexZ z) { Bounds bounds = go.GetRendererBounds(); return(bounds.GetVertex(x, y, z)); }