# AI using character controller makes unwanted change to it's y position

The enemy parent object does not have any colliders except for the character controller. It starts out with y = .57 and immediately jumps to y=1.6355 because of my call to CharacterController.Move(.)

A code snippet is as follows:

myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(targetPos - myTransform.position), rotationSpeed*Time.deltaTime);
Vector3 forward = myTransform.TransformDirection (Vector3.forward);
character.Move (forward * moveSpeed * Time.deltaTime);


The above occurs in my update function. I am reluctant to post more code because this is for an assignment.

I feel like I've tried everything. Using rigidbodies, I fixed this problem but then the enemies began to overlap when they got close. So I reverted back to character controllers. In either case I have been trying different ways of keeping y constant, freezing it, making the y rotation component zero, you name it.

One other thing I'll note is that the enemy moves to this y position regardless of where it is initially placed. My main character also starts a distance in the sky and falls down. It so happens that the y position it ends up is this same one that the enemy teleports to.

EDIT: Also I am on Unity 5.2
EDIT 2: This is for a script I use to make the AI follow my player. It is similar to many you will find just googling, because I based it off of those. I have even tried other people's scripts and had the same problem.
EDIT 3: If I put the enemy lower to the ground (say y=.55) he will not pop up like before. However, he doesn't move toward the player anymore.

• is your game 2d or 3d? and why do you have character controller as child? – Saad Anees Apr 12 '16 at 16:29
• Do you have any animators running on these objects? Those can cause objects to jump to absolute positions. – Evan May 20 '16 at 21:01
• Yes, they did have associated animations. – Stumbleine75 May 22 '16 at 6:57