I cannot get the enemy to move at all. I must be missing something. They animate but stand still.
if (distanceToPlayer < ((EnemyStats)stats).ViewDistance)
{
//Change animation if need be
if (!animation.IsPlaying("walk"))
animation.Play("walk");
Vector3 direction = target.position - transform.position;
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(direction), 10.0f * Time.deltaTime);
transform.eulerAngles = new Vector3(0, transform.eulerAngles.y, 0);
Vector3 forward = transform.TransformDirection(Vector3.forward);
direction = forward * ((EnemyStats)stats).MonsterSpeed;
((CharacterController)characterController).SimpleMove(direction);
Debug.Log("Moving");
}
else
{
//Change animation if need be
if (!animation.IsPlaying("idle"))
animation.Play("idle");
//transform.LookAt(target);
Debug.Log("Stopped");
}
Any ideas? Does the owner of theis script (enemy) need something beyond the Character controller?