This file contains hidden or 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; | |
using System.Collections.Generic; | |
public class LineOfSight : MonoBehaviour | |
{ | |
public float apertureAngle; | |
public float maxSightDistance; | |
public int iterations; | |
private GameObject _lineOfSightGo; |
This file contains hidden or 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
Mesh GenerateSightMesh (int iterations) | |
{ | |
Mesh m = new Mesh (); | |
List<Vector3> vertices = new List<Vector3>(); | |
List<int> triangles = new List<int>(); | |
List<Color> colours = new List<Color>(); | |
Vector3 startingPoint = transform.position; | |
vertices.Add (startingPoint); | |
float angleStep = apertureAngle / iterations; | |
RaycastHit hit; |