moving object whilst keeping a constant y position

I am making a sprite based top down shooter, and am having a problem with my enemies changing vertical plane when perusing the player.

here is my script for the enemy movement

function lookAt()
    renderer.material.color = Color.yellow;
    var rotation = Quaternion.LookRotation(Target.position - transform.position);
    transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * Damping);

function chase()   
    renderer.material.color =;
    moveDirection = transform.forward;
    moveDirection *= moveSpeed;
    controller.Move(moveDirection * Time.deltaTime);

how can I make it so the y position stays constant?


var playerRidg = rigidbody.velocity;

playerRidg.y = //enter desired value, where you want the player to remain

rigidbody.velocity = playerRidg;

I’m not quite sure what you mean, but from what i see , can’t you just do transform.position.y = whateverNumberYouWantItToStayAt;

transform.eulerAngles = new Vector3(transform.eulerAngles.x, 0,transform.eulerAngles.z);