- Home /
How to rotate the planar region to alway face the camera?
I have an plane object which is the target for Camera.LookAt. I want to rotate the plane in a way that always the planar region faces the camera. Help??
Answer by Dave-Carlile · May 30, 2013 at 12:28 PM
Just have your plane transform LookAt the camera.
I did it but this rotates the axis of the plane which is not desired
Please use the comment button for comments, not the answer button. I converted it for you.
Answer by robertbu · Jun 01, 2013 at 01:50 AM
First, this is easiest if the natural rotation of the plane is vertical. You can use the CreatePlane script to create a vertical plane. If you use the build-in plane, I suggest you have an empty game object with rotation(0,0,0) with the build-in plane as a child with a rotation that faces the camera. If you camera is looking at positive 'Z' (default camera setup in a new scene), then you can use (-90,0,0) for the plane rotation.
As for the rotation script, you can put these lines in Update() of a script attached to the plane (or on the empty game object if you go with the build-in plane solution):
var v3 = transform.position - Camera.main.transform.position;
transform.rotation = Quaternion.LookRotation(v3);
Your answer
Follow this Question
Related Questions
Camera pitch/yaw relative to plane 2 Answers
Camera Orbit Rotation Problem 0 Answers
Wonky Camera Behaviours 0 Answers
I can see objects through other ones. 0 Answers
Rotating Camera around Player at Certain Point in Map 0 Answers