I started working with Unity3d and scripting last week. I am trying to make a door open when the player presses “Enter”. I have a rectangular trigger on each side of the door. I attached the door_open animation to the outside door trigger and door_close animation to the inside door trigger. The door is also tagged “door”. I’m guessing I’ll have to attach 2 javascripts to the player called “door_open” and “door_close”. Here is my “door_open” script thus far (attached and below). It has errors still. Any help would be greatly appreciated.
function Update ()
{
function OnTriggerEnter (collision : Collider)
{
if(collider.gameObject.tag==“door” Input.GetKeyDown(“Enter”));
{
hit.collider.gameObject.animation.Play(“door_open”);
}
}
}
