private void Update() { Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 20, Color.red); RaycastHit hit; //make a raycast called hit Ray ray = Camera.ScreenPointToRay(new Vector2(Screen.width / 2, Screen.height / 2)); //make a ray that casts from screen center if (Input.GetKeyDown(KeyCode.E)) //if e pressed { if (Physics.Raycast(ray, out hit, armLength)) { if (hit.collider.tag == "Rope") { print("Yeet, I found a rope tag papi"); rope = hit.collider.gameObject.GetComponent <RopeBehaviour>(); BurnRope(); } } } CheckDeath(); }
private void Awake() { ropeBehaviour = GetComponent <RopeBehaviour>(); }