Animator anim;
    public Image reticle;
    public GameObject CamOffset;
    private float timeElapsed
    
    // Start is called before the first frame update
    void Start()
    {
        anim = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        raycast();
        
    }

    void raycast()
    {
        RaycastHit hit;
        Vector3 forward = transform.TransformDirection(Vector3.forward * 1000);
        if (Physics.Raycast(transform.positionforwardout hit))
        {
            Debug.Log("is hit");
            movement(hit);
        }

        Debug.DrawRay(transform.positionforwardColor.green);
    }

    void movement(RaycastHit hit)
    {
        if(hit.transform.tag == "drawer")
        {
            reticle.fillAmount = timeElapsed / 6;
            timeElapsed = timeElapsed + Time.deltaTime;
            if (timeElapsed >= 3)
            {
                anim.SetBool("Open",true);
                anim.SetBool("Close",false);
                Debug.Log("Table_Opened");
            }

            else if (timeElapsed >= 6)
            {
                anim.SetBool("Close",true);
                anim.SetBool("Open",false);
                Debug.Log("Table_Closed");
            }

            else 

            {
                anim.SetBool("Open",false);
                anim.SetBool("Close",false);
            }

        }
    }

이런 함수를 짰는데 레이캐스트를 쏘지도 않았는데 open 애니메이션이 실행되고 "table_opened" 값도 호출이 안된다


이거 우짜면 좋냐