private void Awake() { if (input == null) { input = GetComponent <XRInputManager>(); } if (cooldownSystem == null) { cooldownSystem = FindObjectOfType <CooldownSystem>(); } }
void Update() { var cameraForward = Player.transform.forward; var vectorToObject = transform.position - Player.transform.position; // Check if the angle between the camera and object is within the hover range var angleFromCameraToObject = Vector3.Angle(cameraForward, vectorToObject); if (angleFromCameraToObject <= maximumAngleForEvent) { Hovering(); if (XRInputManager.IsButtonDown() || Input.GetMouseButtonDown(0)) { ButtonPressed(); } } else { NotHovering(); } }
void Update() { if (this.transform.position == currLocation.position) { MoveToNextLocation(); } else { this.transform.position = Vector3.MoveTowards(this.transform.position, currLocation.position, .01f); } if (XRInputManager.IsButtonDown() || Input.GetMouseButtonDown(0)) { Ray ray = GameObject.Find("Player").transform.GetChild(0).GetComponent <Camera>().ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.collider.name == "Donut_01") { SceneManager.LoadScene(1); } } } }