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.

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

1 Answer 1


It seems to me that your character collider is partially embedded in the ground plane at y=0.57, and the rounded bottom of the capsule collider pushes it up to y = 1.6355, which is the height at which your collider rests on the ground. This seems almost certain given that the main character collider ends up at the same height after falling from above.

At y = 0.55, the collider may be low enough that the ground plane is intersecting with the cylindrical portion of the collider, which would not provide the same upward push.

If you want your parent object to have a y value of 0.55, you'll need to move the character collider upwards, relative to the parent, so that the bottom of the capsule lines up with the ground plane.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .