Skip to content

Instantly share code, notes, and snippets.

@boustrophedon
Created October 19, 2015 03:16
Show Gist options
  • Save boustrophedon/316d1dd390efa39e953c to your computer and use it in GitHub Desktop.
Save boustrophedon/316d1dd390efa39e953c to your computer and use it in GitHub Desktop.
foreach (NavMeshAgent a in agents)
{
if (a.GetComponent<Animator>() != null)
{
Animator anim = a.GetComponent<Animator>();
anim.SetFloat("VSpeed", a.velocity.z);
anim.SetFloat("HSpeed", a.velocity.x);
if (Input.GetButtonDown("Fire3")) {
anim.SetBool("Running", true);
}
else if (Input.GetButtonUp("Fire3")) {
anim.SetBool("Running", false);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment