Animation HELP

Hello, I need advice about a script that should do that when I came to the door that would be triggered animation OpenDoor name, and as I turn from them went a little farther, it would be launched CloseDoor animation. Please help me with this, and if the script can write to me here, because when you write to be only part way in it does not know me and I have a lot of mistakes. thank you

Use triggers and call an animation on the door when the player enters the triggers. Use the scripting reference, and follow some tutorials.

I would like to do as you say, but I do not know how. I would say that I have to make an object, and then put the transparency doněj insert script, but I do not know at all how it should look like this ascript … I am a beginner at the expiry of this you have to explain it to me simply

Hi, did something similar, this may help. I set up the animations in max first.
Code below:

////////////////////////////////////////////////////////////////////////////

using UnityEngine;
using System.Collections;

public class drawer1toopen : Interactive
{
protected bool isDoorOpen = false;
public void Awake()
{

}

public override string GetInteractionMessage()
{
string message = “”;
if (isDoorOpen)
{
message = “Close Drawer”;
}
else
{
message = “Open Drawer”;
}
return message;
}

public override void Interact()
{
if (isDoorOpen)
{
this.transform.animation.Play(“rd1close”);

}
else
{
this.transform.animation.Play(“rd1open”);
}
isDoorOpen = !isDoorOpen;

}
}

writing it is not working and that two erory Assets / Scripts / Test.cs (12:24): error CS0115: drawer1toopen.GetInteractionMessage () 'is Marked with an override Suitable But no method found that the override and Assets / Scripts / Test.cs (26.22): error CS0115: drawer1toopen.Interact () 'is Marked with an override Suitable But no method found that the override

someone please help me how to get rid of those errors here or write a new script would be very mean to me

Hi!
I give you some help with it.
Add a sphere collider to your door model (NOTE* Scale that collider much bigger then the actual door, like 2 times more, dont forget to mark it Trigger)
Make sure your player are tagged as “Player”
Now copy this JavaScript and save it, assign that script to a door object with SphereCollider

var enter : boolean;

function Update (){
if(enter){
animation.Pay("You open animation name");
}else{
animation.Play("Your close animation name");
}

function OnTriggerEnter(other : collider){
if(other.gameObject.tag == "Player"){
enter = true;
}

function OnTriggerExit(other : collider){
if(other.gameObject.tag == "Player"){
enter = false;
}
}
}

NOTE* The animation component need be at the same object where you assign the script.

Now when you come close to the door, it will be open, and when move out - close.

Also you can check good door tutorial here

It work Thanks!!!

noooooooooooo how it started here first so I did not write the error started the second game here and there I was about 6 erorů here is you

Assets / Scripts / Doors / Doors.js (10,10): BCE0044: Expecting (‘found’ OnTriggerEnter '.
Assets / Scripts / Doors / Doors.js (10:31): BCE0044: Expecting), found ‘:’.
Assets / Scripts / Doors / Doors.js (10.32): UCE0001: ‘,’ EXPECTED. Insert a semicolon at the end.
Assets / Scripts / Doors / Doors.js (10.41): BCE0043: Unexpected token:).
Assets / Scripts / Doors / Doors.js (11.1) BCE0043: Unexpected token: if.
Assets / Scripts / Doors / Doors.js (11.37): UCE0001: ‘,’ EXPECTED. Insert a semicolon at the end.
Assets / Scripts / Doors / Doors.js (12.7): BCE0044: Expecting, ‘found’ = '.

do not know how to get rid of it?

please anyone help me

I’ve got it but only 50% on youtube I found a script that starts the animation when it comes to the door but opens a door opening animation. I need to have the door shut from them as I go.
Here is the script

  OnControllerColliderHit function (hit: ControllerColliderHit)

{

if (hit.gameObject.tag == "door")

{

hit.gameObject.animation.Play ("DoorOpen");

}

}


[/ code]

Have you follow the video tutorial i gave you?
Your errors mean that at some lines you forget to put this symbol “;”
Try to copy script again from website.

yes the tutorial from your site NSdesignGames I looked and there is nothing new I could not find a way of opening the door I’ve had for a long time, but I just needed to start the animation when it comes to the door and animation such that the door will ride up and then both of them I go to launch another animation and doors that slide down again. But I do not know how to do it.