Bearbeiten

Freigeben über


MathUtilities.IsInFOVCone(Transform, Vector3, Single, Single, Single) Method

Definition

Returns true if a point lies inside the cone described with given parameters, false otherwise. The cone is inscribed to a radius equal to the vertical height of the provided FOV. The test also ensures the distance from the point to the cone lies within the given range.

public static bool IsInFOVCone (UnityEngine.Transform cone, UnityEngine.Vector3 point, float fieldOfView, float minDist = 0.05, float maxDist = 100);
static member IsInFOVCone : UnityEngine.Transform * UnityEngine.Vector3 * single * single * single -> bool
Public Shared Function IsInFOVCone (cone As Transform, point As Vector3, fieldOfView As Single, Optional minDist As Single = 0.05, Optional maxDist As Single = 100) As Boolean

Parameters

cone
UnityEngine.Transform

The transform that defines the orientation and position of the cone

point
UnityEngine.Vector3

The point to test if it lies within the cone FOV

fieldOfView
Single

Field of view for the cone which calculates its radius

minDist
Single

Point must be at least this far away (along direction forward) from the cone

maxDist
Single

Point must be at most this far away (along direction forward) from the cone.

Returns

Remarks

Field of view parameter is in degrees and distances are in meters.

Applies to