Hey All! I’m currently revising and touching up my game and I’ve run into the problem where I’m transform.translating during other animations, which I obviously do not want. This is what I currently have. It prevents transform.Translate being called when I’m playing a different animation & pressing W (which is not necessary, but may be accidental or habitual).
if (Input.GetKey (KeyCode.W)) {
anim.SetBool("isRunning", true);
anim.SetBool("isIdle", false);
anim.SetBool("isWalking", false);
if (anim.GetCurrentAnimatorStateInfo(0).IsTag("Run")){
transform.Translate(Vector3.forward * speed * Time.deltaTime);
}
}
This works, but has about a .5 second delay and quite noticeable when playing. Is there a way to speed up getting the current state info? Or perhaps someone has a better idea to only transform.Translate during the Running animation.