CameraFOVChecker.IsInFOVCached(Camera, Collider) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Test if a collider's bounds is within the camera's field of view.
public static bool IsInFOVCached(this UnityEngine.Camera camera, UnityEngine.Collider myCollider);
static member IsInFOVCached : UnityEngine.Camera * UnityEngine.Collider -> bool
<Extension()>
Public Function IsInFOVCached (camera As Camera, myCollider As Collider) As Boolean
Parameters
- camera
- UnityEngine.Camera
The camera to test.
- myCollider
- UnityEngine.Collider
The collider to test.
Returns
true if a collider's bounds is within the camera's field of view, otherwise false.
Remarks
This function utilizes a cache to test if this collider has been seen before and returns current frame's calculated result.
This is a loose field of view check, meaning it can return true in cases when the collider is actually not in the field of view. This is because this function does an axis-aligned check when testing for large colliders. So, if the axis aligned bounds are in the bounds of the camera, it will return true.