How to have child object only follow parent x position

I have a background image that was a child to the camera so that it moves with the camera, but when the camera rotates, i don’t want the background to rotate with it.

I thought the obvious solution was to just set the bg to the camera’s x position in the update function, but for some reason, this resulted in a very choppy background movement. I also tried forcing the bg’s rotation to stay at 0, but that doesn’t affect it’s world rotation so it still rotates with the parent. I tried making the bg turn in the opposite direction from the camera, but this was difficult to make look good.

Is there a way to to get bg to follow the camera’s x-position smoothly?

I think setting the bg to the camera’s x position will work if you the bg is not a child of camera, does it have to be a child?

I’m not sure, but you can try

transform.position = targetOb.position(x)

I don’t have Unity near me and I’m only 9 years old so I’m not sure if this works. (My guess is probably not but this is the best I can do.

try freezing y and z movement,
make bg child of the camera, and add a rigidbody body to bg, then disable use gravity, then go to constraints, freeze all rotations and freeze movement of y and z.
I hope that might help.