Problem - Getting Object to Face Camera Plane

Hello,

I’m using this code:

var rotation = Quaternion.LookRotation(-Camera.main.transform.forward);
transform.rotation.y = rotation.y;

To get my GUI objects to always face the plane direction of my camera, works fine until I reach a certain angle, which is about 170, lower than this and the GUI doesn’t move, unless I keep pivoting around, and then it will ‘snap’ facing the camera again at an angle of 289.

Any reason why it is doing this?

Why not use tranform.LookAt instead?

Your problem is that you are trying to set the Y of a Quaternion - you shouldn’t fiddle with the elements of a quaternion directly - you probably mean to use the eulerAngles. The y of a Quaternion is not the rotation about the y axis.