Example #1
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;
        Vector3    fwd = transform.TransformDirection(Vector3.forward);

        if (Physics.Raycast(transform.position, fwd, out hit, raylenght, layerMaskInteract.value))
        {
            if (hit.collider.CompareTag("BOX"))
            {
                raycastedObj = hit.collider.gameObject;
                if (Input.GetKeyDown("mouse 0"))
                {
                    SerialController.Send("1");
                    Debug.Log("I HAVE INTERACTED WITH AN OBJECT");
                }
            }
        }
    }