I am trying to make a basic camera movement portion of my script though it is working terribly and no Rotation numbers seem match up with what it is displaying in the Inspector and what is being printed out by the console…

I am trying to make the camera have a roll around effect over the top of the object (as seen in the video), though what is happening is I cannot seem to match up the numbers in the Inspector my GameObjects transfrom is set to Rotation: x:180, y:180, z:180 though it states that the First Euler angle in the console I am being told that the Angle is infact 0° not 180°

Video of my Intentions for this code: Unity Rotate Error - YouTube

The aim is persay the cameras rotation is 0,0,0 (y rotation is not used for this purpose) if I push the [W] key the camera tilts forward on the x rotation until it hits its maximum, the maximum should be 45° and the minimum being 0° so If I hit that 45° limit, I now can no longer move forward no matter if Im pressing [W] or not, now I should be able to press ~~to start moving backward back toward 0°.~~

~~The same goes for Moving Left and right, though the difference is that 0° is the Middle ground, +50° is tilted all the way to the right and -50° is tilted all the way to the left.~~

~~So long story short how I i make a Minimum and Maximum that the rotations can play around and be contained in? as the way my code currently works is~~

~~Right(+z): Stop at +50° which in Euler Terms is 50° and in Unity Transform terms is 230~~

~~Left(-z): (Should) Stop at -50° which in Euler Terms is 310° and in Unity Transfrom Terms is 130~~

~~Forward (+x): (Should) Stop at +45° which in Euler Terms is 330° and in Unity Transform terms is 210~~

~~Backward(-x): (Should) Stop at 0° which in Euler Terms is 0° and in Unity Transform Terms is 180~~

~~Code:~~

~~void moveLeft()~~

~~{~~

~~Debug.Log("z Rotation is Currently: " + cameraTrans.eulerAngles.z);~~

~~if (cameraTrans.eulerAngles.z < 310 || cameraTrans.eulerAngles.z > 50)~~

~~{~~

~~cameraTrans.Rotate(0, 0, -Time.deltaTime * moveSpeed);~~

~~currentXAngle = cameraTrans.eulerAngles.x;~~

~~currentZAngle = cameraTrans.eulerAngles.z;~~

~~}~~

~~}~~

~~void moveRight()~~

~~{~~

~~Debug.Log("z Rotation is Currently: " + cameraTrans.eulerAngles.z);~~

~~if (cameraTrans.eulerAngles.z < 50 || cameraTrans.eulerAngles.z > 310)~~

~~{~~

~~cameraTrans.Rotate(0, 0, Time.deltaTime * moveSpeed);~~

~~currentXAngle = cameraTrans.eulerAngles.x;~~

~~currentZAngle = cameraTrans.eulerAngles.z;~~

~~}~~

~~}~~

~~void moveForward()~~

~~{~~

~~Debug.Log("x Rotation is Currently: " + cameraTrans.eulerAngles.x);~~

~~if (cameraTrans.eulerAngles.x > minXRot)~~

~~{~~

~~cameraTrans.Rotate(-Time.deltaTime * moveSpeed, 0, 0);~~

~~currentXAngle = cameraTrans.eulerAngles.x;~~

~~currentZAngle = cameraTrans.eulerAngles.z;~~

~~}~~

~~}~~

~~void moveBackward()~~

~~{~~

~~Debug.Log("x Rotation is Currently: " + cameraTrans.eulerAngles.x);~~

~~if (cameraTrans.eulerAngles.x < maxXRot)~~

~~{~~

~~cameraTrans.Rotate(Time.deltaTime * moveSpeed, 0, 0);~~

~~currentXAngle = cameraTrans.eulerAngles.x;~~

~~currentZAngle = cameraTrans.eulerAngles.z;~~

~~}~~

~~}~~

~~Please understand I have been stuck on this for over 2 days now, trying all different types of numbers variations and code, so my code is super messy now and probably to some does not make any sense~~

~~(for today I have been ignoring to work on the forward and backward functions… it is broken beyond beleif and am simply trying to work out it’s left and right movement before I bombard myself with 4 different angles to try get right at once.)~~

~~Current Code at work Video:~~

~~UnityError pt 2 - YouTube