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.