using Cysharp.Threading.Tasks; using GhostSystem; using NUnit.Framework; using UnityEngine; public class EyeTrackingCollisionPoints : MonoBehaviour { [SerializeField] private float rayDistance = 1.0f; [SerializeField] private LayerMask layersToInclude; public GameObject hitPointPrefab; public GameObject hitPoint; private void FixedUpdate() { RaycastHit hit; Vector3 rayCastDirection = transform.TransformDirection(Vector3.forward) * rayDistance; if ( hitPoint != null && Physics.Raycast(transform.position, rayCastDirection, out hit, rayDistance, layersToInclude)) { hitPoint.transform.position = new Vector3(hit.point.x, hit.point.y, hit.point.z); if (hit.collider.GetType() == typeof(MeshCollider)) { hit.collider.gameObject.GetComponent().addHitPoint(hit.textureCoord.x, hit.textureCoord.y); } } } public Transform SpawnHitPoint() // Wird durch LocalPlayerReferences aufgerufen, um nicht zu oft den GhostRecorder zu suchen. { hitPoint = Instantiate(hitPointPrefab); return hitPoint.transform; } }