Door Mechanic

Sliding_door_script

using UnityEngine;
public class Sliding_Door_Script : MonoBehaviour
{
    public GameObject trigger;
    public GameObject leftDoor;
    public GameObject rightDoor;

    Animator leftAnim;
    Animator rightAnim;

    // Start is called before the first frame update
    void Start()
    {
        leftAnim = leftDoor.GetComponent <Animator > ();
        rightAnim = rightDoor.GetComponent <Animator > ();
    }

    void OnTriggerEnter(Collider coll){
        if (coll.gameObject.tag == “OVRPlayerController”) {
           SlideDoors (true);
        }
    }

    void OnTriggerExit(Collider coll)
    {
        if (coll.gameObject.tag == “OVRPlayerController”)
        {
            SlideDoors(false);
        }
    }
    void SlideDoors(bool state)
    {
        leftAnim.SetBool(“Slide”, state);
        rightAnim.SetBool(“Slide”, state);
    }

    //end o class
}

I have created Animations and animation controllers for the door mechanic but they seem to be either opening immediately the scene opens, not responding to player controller collider or opening alternately (with different modifications)

Left door Idle
Left door Open
Left door Closed

Right Door Idle
Right Door Open
Right Door Closed

Tutorial: https://www.linkedin.com/learning/unity-3d-essential-training/animation-clips-and-controllers?u=56738929