Hello everyone,
I have an animator component for a zombie npc using bool parameters to switch between motions the running animation being the default one.And i use a navmesh agent to make the zombie follow the player. The problem is that the zombie does follow the player but doesn’t play the running animation it just translates forward.
Here is the script for the AI:
void Awake ()
{
hash =GameObject.FindGameObjectWithTag(“GameController”).GetComponent();
nav = GetComponent();
player = GameObject.FindGameObjectWithTag(“Player”).transform;
playerHealth = player.GetComponent();
anim = GetComponent();
}
void Update ()
{
transform.LookAt(player.position);
anim.SetFloat(hash.speedFloat, nav.speed);
nav.destination = player.position;
}
Can anyone help with this please?
Thanks a lot.