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