Question by
JungOmul · Nov 16, 2017 at 03:38 PM ·
animationanimatortriggerontriggerenterontriggerexit
About the door animation trigger
Hi. I'm trying to make when Player goes to trigger, the door opens and closes when exiting the trigger. I know that I should use OnTriggerEnter and OnTriggerExit.. But this is the first time I'm using animation to trigger. So I'm little confused. I want to make animation happens by code not animator. I think animator is useless when it gets to trigger. I set like this. I made DoorOpen DoorClose animations and put those animations to Door's animator.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DoorController : MonoBehaviour {
// Use this for initialization
void OnTriggerEnter (Collider other)
{
if(other.CompareTag("Player")
{
blahblahblah
}
// Update is called once per frame
void OnTriggerExit ()
{
blahblahblah
}
}
Please help me! If you have better idea, thats fine. Tell me all!
1.png
(43.1 kB)
Comment