stop camera jump


I have a player that jumps when I hit space bar. The camera is a child object of the player.

What I want is when the player jumps the camera doesnt jump with the player and stays on the same y level.
I just want the camera to follow x,z movements.

Is there an easy way to do this?

I didnt really get this post to the same question

no it doesnt. I found the answer.

void Start () {

	startx=player.transform .position.x;
	starty=transform .position.y;

// Update is called once per frame
void Update () {
	 transform.position = new Vector3(transform .position.x, starty, transform .position.z);