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