Teachers open the door but You must enter by yourself.
using UnityEngine;
public class Horse : MonoBehaviour
{
public float velocity=7.5f;
public bool running=false;
void Start(){
GetComponent<Horse>().Run();
}
void Update(){//馬を前に進める
if(running){
GetComponent<CharacterController>().Move(Vector3.forward*velocity*Time.deltaTime);
}
}
public void Run(){
GetComponent<Animator>().SetTrigger("run");
running = true;
}
public void Stop(){
GetComponent<Animator>().SetTrigger("stop");
running = false;
}
}