Preventing a gameobject from looking upwards?

I have a gameobject that looks at another gameobject above it using Quaternion.Slerp. I want the gameobject on the ground to look in the direction of the other gameobject in the air but I don’t want it to look up directly at it.

I want the gameobject on the ground to have its rotation.x to be 0 so it doesn’t look upward at the gameobject above it. This is the code I have but its still attempting to look up at the gameobject in the air.

Quaternion LookRot = Quaternion.LookRotation (controller.chaseTarget.position - controller.transform.position);

							Quaternion Rot = new Quaternion (0f, controller.transform.rotation.y, controller.transform.rotation.z, controller.transform.rotation.w);

							controller.transform.rotation = Quaternion.Slerp (Rot, LookRot, Time.deltaTime * 10);

This may not be the most efficient (performance wise) solution, though I think it is the easiest to understand with basic vector math. Optionally, caching the transform as a class member in void Start can speed this up if performance is a concern (if called for many objects in Update)

// calculate direction vector to target
Vector3 dir = target.position - transform.position;

// get the current world rotation vector
Vector3 rot = transform.eulerAngles;

// only change the Y rotation to look at the target direction
rot.y = Quaternion.LookRotation(dir).eulerAngles.y;

// convert target rotation to quaternion
Quaternion targetRot = Quaternion.Euler(rot);

// use slerp for smooth look
transform.rotation = Quaternion.Slerp (transform.rotation, targetRot, 
    Time.deltaTime * 10.0f);