Security camera type lookat movement?

I am trying to setup a fixed position camera that follows an object as it moves left and right in a scene.

Using the lookat function works ok, however I only want the camera to rotate left and right as the object moves, but not follow the movement as the object comes near or moves further away from the camera, hope that makes sense.

So really only want the camera to follow the objects movement for one of its axis.

Thanks in advance!

Heres my guess, just manually set the rotation of the other two axies a line after the exixting LookAt code:

//existing code
transform.rotation.x=0;
transform.rotation.z=0;
//end of script

I recall doing this and it worked fine

HTH
AC

Perfect, it works!

The simple ones are the best!

Many thanks Aaron!