Quaternion.Slerp and Quaternion.Euler problem

Greetings.

I am making a script that uses Quaternion.Slerp command. It works, but I need to constrain the x and z-axis rotation so that only y-axis rotates. I’ve tried this with Quaternion.Euler but it didn’t work. Here is a snippet of my script.

private var speed = 5;
    var newRotation = Quaternion.LookRotation(targetObj.position - head.transform.position);
    
    head.transform.rotation = Quaternion.Slerp(head.transform.rotation, Quaternion.Euler(0,newRotation.y,0), Time.deltaTime * speed);

Thank you in advance.

Okay nevermind. I got it. Just specified the x and z initially and it works.

var newRotation = Quaternion.LookRotation(targetObj.position - head.transform.position);
newRotation.x = 0;
newRotation.z = 0;

    head.transform.rotation = Quaternion.Slerp(head.transform.rotation, newRotation, Time.deltaTime * speed);

I’m just wondering if there is an overall implication to how the object react to other scripts, but it looks okay for now.