Feel  3.16
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.MMConeOfVision Class Reference

This class will create a cone of vision defined by an angle and a distance around a point. It will look for targets within that field, and draw a mesh to show the cone of vision initially inspired by this great tutorial by Sebastian Lague : https://www.youtube.com/watch?v=rQG9aUWarwE - check out his tutorials, they're amazing! More...

Inheritance diagram for MoreMountains.Tools.MMConeOfVision:

Classes

struct  MeshEdgePosition
 
struct  RaycastData
 A struct to store raycast data More...
 

Public Member Functions

virtual void SetDirectionAndAngles (Vector3 direction, Vector3 eulerAngles)
 

Public Attributes

LayerMask ObstacleMask
 
float VisionRadius = 5f
 
float VisionAngle = 20f
 
Vector3 Direction
 
Vector3 EulerAngles
 
Vector3 Offset
 
bool ShouldScanForTargets = true
 
LayerMask TargetMask
 
float ScanFrequencyInSeconds = 1f
 
List< Transform > VisibleTargets = new List<Transform>()
 
bool ShouldDrawMesh = true
 
float MeshDensity = 0.2f
 
int EdgePrecision = 3
 
float EdgeThreshold = 0.5f
 
MeshFilter VisionMeshFilter
 

Protected Member Functions

virtual void Awake ()
 
virtual void LateUpdate ()
 
virtual void ScanForTargets ()
 
virtual void DrawMesh ()
 

Protected Attributes

Mesh _visionMesh
 
Collider[] _targetsWithinDistance
 
Transform _target
 
Vector3 _directionToTarget
 
float _distanceToTarget
 
float _lastScanTimestamp
 
List< Vector3 > _viewPoints = new List<Vector3>()
 
RaycastData _oldViewCast = new RaycastData()
 
RaycastData _viewCast = new RaycastData()
 
Vector3[] _vertices
 
int[] _triangles
 
Vector3 _minPoint
 
RaycastData _returnRaycastData
 
RaycastHit _raycastAtAngleHit
 
int _numberOfVerticesLastTime = 0
 

Properties

virtual Vector3 Center [get]
 

Detailed Description

This class will create a cone of vision defined by an angle and a distance around a point. It will look for targets within that field, and draw a mesh to show the cone of vision initially inspired by this great tutorial by Sebastian Lague : https://www.youtube.com/watch?v=rQG9aUWarwE - check out his tutorials, they're amazing!

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.MMConeOfVision.Awake ( )
protectedvirtual

◆ DrawMesh()

virtual void MoreMountains.Tools.MMConeOfVision.DrawMesh ( )
protectedvirtual

◆ LateUpdate()

virtual void MoreMountains.Tools.MMConeOfVision.LateUpdate ( )
protectedvirtual

◆ ScanForTargets()

virtual void MoreMountains.Tools.MMConeOfVision.ScanForTargets ( )
protectedvirtual

◆ SetDirectionAndAngles()

virtual void MoreMountains.Tools.MMConeOfVision.SetDirectionAndAngles ( Vector3  direction,
Vector3  eulerAngles 
)
virtual

Member Data Documentation

◆ _directionToTarget

Vector3 MoreMountains.Tools.MMConeOfVision._directionToTarget
protected

◆ _distanceToTarget

float MoreMountains.Tools.MMConeOfVision._distanceToTarget
protected

◆ _lastScanTimestamp

float MoreMountains.Tools.MMConeOfVision._lastScanTimestamp
protected

◆ _minPoint

Vector3 MoreMountains.Tools.MMConeOfVision._minPoint
protected

◆ _numberOfVerticesLastTime

int MoreMountains.Tools.MMConeOfVision._numberOfVerticesLastTime = 0
protected

◆ _oldViewCast

RaycastData MoreMountains.Tools.MMConeOfVision._oldViewCast = new RaycastData()
protected

◆ _raycastAtAngleHit

RaycastHit MoreMountains.Tools.MMConeOfVision._raycastAtAngleHit
protected

◆ _returnRaycastData

RaycastData MoreMountains.Tools.MMConeOfVision._returnRaycastData
protected

◆ _target

Transform MoreMountains.Tools.MMConeOfVision._target
protected

◆ _targetsWithinDistance

Collider [] MoreMountains.Tools.MMConeOfVision._targetsWithinDistance
protected

◆ _triangles

int [] MoreMountains.Tools.MMConeOfVision._triangles
protected

◆ _vertices

Vector3 [] MoreMountains.Tools.MMConeOfVision._vertices
protected

◆ _viewCast

RaycastData MoreMountains.Tools.MMConeOfVision._viewCast = new RaycastData()
protected

◆ _viewPoints

List<Vector3> MoreMountains.Tools.MMConeOfVision._viewPoints = new List<Vector3>()
protected

◆ _visionMesh

Mesh MoreMountains.Tools.MMConeOfVision._visionMesh
protected

◆ Direction

Vector3 MoreMountains.Tools.MMConeOfVision.Direction

◆ EdgePrecision

int MoreMountains.Tools.MMConeOfVision.EdgePrecision = 3

◆ EdgeThreshold

float MoreMountains.Tools.MMConeOfVision.EdgeThreshold = 0.5f

◆ EulerAngles

Vector3 MoreMountains.Tools.MMConeOfVision.EulerAngles

◆ MeshDensity

float MoreMountains.Tools.MMConeOfVision.MeshDensity = 0.2f

◆ ObstacleMask

LayerMask MoreMountains.Tools.MMConeOfVision.ObstacleMask

◆ Offset

Vector3 MoreMountains.Tools.MMConeOfVision.Offset

◆ ScanFrequencyInSeconds

float MoreMountains.Tools.MMConeOfVision.ScanFrequencyInSeconds = 1f

◆ ShouldDrawMesh

bool MoreMountains.Tools.MMConeOfVision.ShouldDrawMesh = true

◆ ShouldScanForTargets

bool MoreMountains.Tools.MMConeOfVision.ShouldScanForTargets = true

◆ TargetMask

LayerMask MoreMountains.Tools.MMConeOfVision.TargetMask

◆ VisibleTargets

List<Transform> MoreMountains.Tools.MMConeOfVision.VisibleTargets = new List<Transform>()

◆ VisionAngle

float MoreMountains.Tools.MMConeOfVision.VisionAngle = 20f

◆ VisionMeshFilter

MeshFilter MoreMountains.Tools.MMConeOfVision.VisionMeshFilter

◆ VisionRadius

float MoreMountains.Tools.MMConeOfVision.VisionRadius = 5f

Property Documentation

◆ Center

virtual Vector3 MoreMountains.Tools.MMConeOfVision.Center
get

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