- Home /
How to restrict camera rotation to vertical axis?
My application requires that the player (first person controller) only be able to rotate the first person controller on the vertical axis. How can this be accomplished? My programming skills are very limited; any help much appreciated.
Answer by Drakmyth · Jan 02, 2013 at 07:51 PM
Assuming you're using the standard First Person Controller, simply select the Main Camera child and untick the box for the "Mouse Look (Script)" component. Your character will be able to turn left/right but not look up/down.
If you want the reverse, untick the box for the "Mouse Look (Script)" component on the First Person Controller itself, instead of the Main Camera child.
Answer by Eric Knisley · Jan 03, 2013 at 02:09 AM
That's exactly what I was looking for! Thanks very much. I have been looking around for more than a week for this, and I'm very grateful for the help. FYI, the reason I need this particular restriction is that I'm working on an application for a big panoramic projection system. You can see an early test here:
http://www.youtube.com/watch?v=qqKWrXX-yQ0&feature=youtu.be
Cheers!
Your answer
![](https://koobas.hobune.stream/wayback/20220613090254im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I let a camera follow on one axis? 3 Answers
Is there a way to lock my camera's rotation and movement on certain axis? 2 Answers
Camera rotating with physics based movement. 0 Answers
How to make camera position relative to a specific target. 1 Answer
Limit Y Axis transform.RotateAround 1 Answer