FCV Engine 0.1
A tool and framework for tutorials in game development
Loading...
Searching...
No Matches
FOVUtility Class Reference

A utility class for handling Field of View (FOV) calculations and visualizations in Unity. Includes functions to check if a target is within the FOV and range, and to draw the FOV in the scene view. More...

Static Public Member Functions

static bool IsWithinFOVAndRange (Vector3 source, Vector3 target, Vector3 direction, float maxDistance, float fovAngle)
 Checks if the target is within the Field of View and range of the source.
 
static bool IsWithinFOV (Vector3 source, Vector3 target, Vector3 direction, float fovAngle)
 Checks whether a position is within a Field of View angle from another position.
 

Detailed Description

A utility class for handling Field of View (FOV) calculations and visualizations in Unity. Includes functions to check if a target is within the FOV and range, and to draw the FOV in the scene view.

Definition at line 10 of file FOVUtility.cs.

Member Function Documentation

◆ IsWithinFOV()

static bool IsWithinFOV ( Vector3 source,
Vector3 target,
Vector3 direction,
float fovAngle )
static

Checks whether a position is within a Field of View angle from another position.

Parameters
sourceThe source position.
targetThe target position.
directionThe direction from the source to check the angle from.
fovAngleThe angle in degrees.
Returns
True if the target is within the FOV, otherwise false.

Definition at line 71 of file FOVUtility.cs.

◆ IsWithinFOVAndRange()

static bool IsWithinFOVAndRange ( Vector3 source,
Vector3 target,
Vector3 direction,
float maxDistance,
float fovAngle )
static

Checks if the target is within the Field of View and range of the source.

Parameters
sourceThe position of the source.
targetThe position of the target.
directionThe direction from the source to check the FOV angle from.
maxDistanceThe maximum distance for the FOV check.
fovAngleThe angle of the FOV in degrees.
Returns
True if the target is within both the FOV and range, otherwise false.

Definition at line 46 of file FOVUtility.cs.


The documentation for this class was generated from the following file: