public void Set(Transform t, bool swapYZ) { this.Transform = t; var bounds = BoundsEx.GetBounds(t, false); var localBounds = BoundsEx.GetBounds(t, true); if (swapYZ) { var center = bounds.center; var size = bounds.size; { Util.Swap <float>(ref center.y, ref center.z); Util.Swap <float>(ref size.y, ref size.z); bounds.center = center; bounds.size = size; } center = localBounds.center; size = localBounds.size; { Util.Swap <float>(ref center.y, ref center.z); Util.Swap <float>(ref size.y, ref size.z); localBounds.center = center; localBounds.size = size; } } this.Bounds = bounds; this.LocalBounds = localBounds; }
public static Bounds GetBounds(Transform t, bool local) { return(BoundsEx.GetBounds(t, local, false)); }
public static Bounds GetBounds(Transform t) { return(BoundsEx.GetBounds(t, true, false)); }