public Meta2dBoundsVisibility GetVisibility() { // --------- Rect tmpScreenRect = new Rect(0, 0, Screen.width, Screen.height); int c = 0; // --------- if (tmpScreenRect.Contains(topLeft)) { c++; } if (tmpScreenRect.Contains(topRight)) { c++; } if (tmpScreenRect.Contains(bottomRight)) { c++; } if (tmpScreenRect.Contains(bottomLeft)) { c++; } // --------- if (c == 0) { return(Meta2dBoundsVisibility.NotVisible); } else if (c == 4) { if (MetaVector.isBehindCamera(topLeft) && MetaVector.isBehindCamera(topRight) && MetaVector.isBehindCamera(bottomRight) && MetaVector.isBehindCamera(bottomLeft)) { return(Meta2dBoundsVisibility.BehindCamera); } return(Meta2dBoundsVisibility.Full); } else { if (MetaVector.isBehindCamera(topLeft) && MetaVector.isBehindCamera(topRight) && MetaVector.isBehindCamera(bottomRight) && MetaVector.isBehindCamera(bottomLeft)) { return(Meta2dBoundsVisibility.BehindCamera); } return(Meta2dBoundsVisibility.Partial); } }
// ========================================================================================================================================== // Get the diameter of the object using the collider bounds on the user selected plane protected float GetCollider2dDiameter(bool ParamRecalculate) { if (isCalculatedColliderDiameter && !ParamRecalculate) { return(calculatedColliderDiameter); } GetBounds(true, MetaBoundsType.ColliderBounds); if (Used2DPlane == Meta2dPlaneType.XZ) { calculatedColliderDiameter = MetaVector.MaximizeVectorXZ(bounds.size).x; } else if (Used2DPlane == Meta2dPlaneType.XY) { calculatedColliderDiameter = MetaVector.MaximizeVectorXY(bounds.size).x; } isCalculatedColliderDiameter = true; return(calculatedColliderDiameter); }