- Home /
i need to use the rotation value of the x axis on a camera
im new to unity and this is bugging me alot..afraid that i cant figure out how to get the rotation of the y axis of a camera. I need to assign it to a variable that i can use in an if then statement. the goal is just to limit the amount the camera can move based on its y axis angle ex. if(yaxis < 61 %% yaxix > 0) { transform.Translate(0, y, 0); }
any help would be appreciated it seems like this should be simple i must just be missing something...right?
Answer by Jessy · Feb 01, 2011 at 01:04 AM
Well, you can read the values that get displayed in the Unity Editor, using Transform.eulerAngles. However, Euler rotations are not unique, so you may have to come up with a method that deals with that problem. The first person scripts that come with Unity have examples of how to clamp rotations in a manner that would probably be educational for you.
Your answer
![](https://koobas.hobune.stream/wayback/20220613102132im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Camera Limit Rotations Problem 1 Answer
Transform.rotate limits 3 Answers
simple plane code how to limit rotation 2 Answers
Limit distance from center 0 Answers