using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class TrackPoint : MonoBehaviour { private void OnDrawGizmos() { var position = transform.position; var tan1 = GetBackwardTan(); var tan2 = GetForwardTan(); Gizmos.color = Color.black; Gizmos.DrawLine(position, tan1); Gizmos.DrawLine(position, tan2); Gizmos.color = Color.cyan; Gizmos.DrawSphere(tan1, 0.05f); Gizmos.DrawSphere(tan2, 0.05f); } private void OnDrawGizmosSelected() { Gizmos.color = Color.blue; Gizmos.DrawSphere(transform.position, 0.2f); } public float GetTanLength() { return transform.localScale.z; } public Vector3 GetForwardTan() { var t = transform; return t.position + t.forward * GetTanLength(); } public Vector3 GetBackwardTan() { var t = transform; return t.position - t.forward * GetTanLength(); } }