Skip to content

Instantly share code, notes, and snippets.

@tk009999
Created January 26, 2021 03:47
Show Gist options
  • Save tk009999/8ef8d7d0d74bd0f18e8ff3ae3dc12b1a to your computer and use it in GitHub Desktop.
Save tk009999/8ef8d7d0d74bd0f18e8ff3ae3dc12b1a to your computer and use it in GitHub Desktop.
using UnityEngine;
public static class RendererExtensions
{
public static bool IsVisibleFrom(this Renderer renderer, Camera camera)
{
Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera);
return GeometryUtility.TestPlanesAABB(planes, renderer.bounds);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment