Hi everyone, I think it is quite simple question, but I am stuck. My character moves from point to point, but problem is that speed is slowdown when it comes closer to the point. How to make movement more equable?

function myMove(mytarget: Vector3){
var controller : CharacterController = GetComponent(CharacterController);
if (controller.isGrounded) {
moveDirection = (mytarget-transform.position).normalized;
moveDirection *= speed;
}
moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
}

I suspect the difference in heights between the target point and the character is causing this: when moveDirection is normalized, a high Y component will reduce the horizontal velocity component. With a small change, this vertical component can be ignored prior to normalization, what should result in a constant speed:

function myMove(mytarget: Vector3){
  var controller : CharacterController = GetComponent(CharacterController);
  if (controller.isGrounded) {
    moveDirection = mytarget-transform.position;
    moveDirection.y = 0; // ignore vertical distance before normalization
    moveDirection = moveDirection.normalized * speed;
  }
  moveDirection.y -= gravity * Time.deltaTime;
  controller.Move(moveDirection * Time.deltaTime);
}