Transform.LookAt rotate on x-axis
Is there a way to use the transform.lookAt and rotate on the x-axis as well? If not, how do I do it? I have a plane I can rotate on the x-axis. I want the camera to follow the x-axis rotation.
Comment
Answer by hexagonius · Jan 30, 2016 at 11:58 AM
I don't know your setup exactly, but LookAt supports a second parameter of for what up is. if you set it to the planes up, should be fine.
I made a camera follow script for an airplane, and I want the camera to rotate with the plane when it rolls.
Right now I'm just saying:
transform.LookAt(lookAt);
transform.rotation = target.rotation;
But this doesn't have a smooth rotation on the x axis (when the plane rolls)