LookAt, but only kinda

Hey guys, I need some help here. I need a GameObject to rotate towards waypoints in the stage, so transform.LookAt would work great. Except the y-center of the waypoint is at a certain height, and the GameObject rotates upwards to get there.

I need some way to make LookAt only make my GameObject rotate around the Y-axis. I can’t just lock it to a specific X and Z rotation, because those need to be constantly changing according to other parameters. What should I do?

you could get the vector between the target and the thing you wish to look at it, then flatten it, then look at that:

Vector3 offset = target.position - transform.position;
offset.y = 0;
transform.LookAt(transform.position + offset);