Enemy move to player to attack (yes this topic again)

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?

You calculate “direction” vector, but don’t assing it to anything. Use that vector on your object for it to move.

Sure he did…

((CharacterController)characterController).SimpleMove(direction)

I just tried attaching the AI.js (converted to c#) to my mobs, they turn to face me, and animate but do not move. I cannot for the life of me figure out what is wrong. I know its a noob mistake…

tried this code (well similar):

      if(Vector3.Distance(transform.position, enemyTarget.position) < minimunDistance) 
      { 
         var direction = enemyTarget.position - transform.position; 
         transform.rotation = Quaternion.Slerp(transform.rotation,Quaternion.LookRotation(direction), rotationSpeed * Time.deltaTime); 
         transform.eulerAngles = Vector3(0,transform.eulerAngles.y,0); 
         var forward = transform.TransformDirection(Vector3.forward); 
         direction = forward * walkingSpeed; 
         GetComponent(CharacterController).SimpleMove(direction);

and now the enemy object rotates 90 left and sinks down through the floor…HELP !!! hehe.

as extra info - at the moment they drop the values for the Vector3 “forward” are 0,0,1 which seems odd as I am x+ from the enemies.