Created
January 26, 2021 03:47
-
-
Save tk009999/8ef8d7d0d74bd0f18e8ff3ae3dc12b1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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