private bool IsObjectInvisible(GameObject obj)
{
// 获取物体的包围盒
Bounds bounds = obj.GetComponent<Renderer>().bounds;
// 获取摄像机的视锥体平面
Plane[] frustumPlanes = GeometryUtility.CalculateFrustumPlanes(Camera.main);
// 检查包围盒是否与视锥体相交
return !GeometryUtility.TestPlanesAABB(frustumPlanes, bounds);
}
需要Mesh Render