Moving Object following mouse only X position

Hi guys,

i'm trying making my object get moving following the mouse position but only in X position but in my code he follow in Y too and i dont know how i can do this.

Thanks

public class Racket : MonoBehaviour {
	private Vector2 mousePosition;
	public float speed;
	void FixedUpdate () {
		mousePosition = Input.mousePosition;
		mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
		transform.position = Vector2.Lerp(transform.position, mousePosition, speed);
	}
}

using UnityEngine;
using System.Collections;

public class test8 : MonoBehaviour 
{

	private Vector3 targetPos;
	public float speed = 2.0f;
	
	void Start() {
		targetPos = transform.position;    
	}
	
	void Update () {
			float distance = transform.position.z - Camera.main.transform.position.z;
			targetPos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance);
			targetPos = Camera.main.ScreenToWorldPoint(targetPos);

		Vector3 followXonly = new Vector3(targetPos.x, transform.position.y, transform.position.z);
		transform.position = Vector3.Lerp (transform.position, followXonly, speed * Time.deltaTime);
	}
}

Awesome this works great except for 1 thing i still need though, hope someone can help me! :slight_smile:

How to make the gameObject not "Brake so slow… it picks up speed quite good then it slowly reach its destination… how to accelerate and reach its destination at a constant speed?