How to lock an axis on a character controller?

For rigidbodies, we are able to lock an axis. I wanted to lock the y and x axis so the character does not look up or down. The following is what I use to rotate.

var targetRotation = Quaternion.LookRotation(targetPoint - transform.position, Vector3.up);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0);  

Is there perhaps some type of 0 quaternion i could multiply the quaternion by to set the rotation to (0, 0, z)?

Well, to turn a Vector3 into a float you can always use trig (remember highschool maths? That was fun, wan’t it!)-

float angle = Atan2(point.x, point.z);

However, for what you want to do, you could do something clever like, before you do the LookRotation bit you could fix its Y value so that you never face up or down-

point.y = transform.position.y;

that way, it never tilts!

I figured a way to fix it. I changed the point to which i was pointing’s x value to that of the gameobject that way it never points in a certain direction in correspondence to the x or z axis.
targetPosition.x = Player.gameObject.transform.position.x
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(targetPoint - transform.position, Vector3.up), Time.deltaTime * 2.0);

I figured it out. I changed my targetPosition variable’s (where I am going to be pointing at) y value to that of the gameObject. That way it never looks up or down. The code looks like this.
targetPosition.y = Player.gameObject.transform.position;
var targetRotation = Quaternion.LookRotation(targetPoint - transform.position, Vector3.up);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0);