- Home /
Mose look no limits
Hello, I have been a unity user for quite a while now and i've been working on a new FPS game and its working great, the only problem is, on one mission the player is sitting inside a helicopter but no matter what he can always do a 360* rotate and I write different numbers of limits and even watched a tutorial and done the EXACT same thing and the guy on the tutorial worked but not mine! I'm using the default unity Mouse Look script and my Y axis works fine, but the X axis won't listen to any of the numbers I write in, Sensitivity amounts are ok its just the "Maximum X and Minimum X". Please help. Thankyou.
-Kickasskane Productions
you need to post a code in the problem area, since you know something has worked and its not working for you, its probably code.
Answer by Berenger · Jun 07, 2012 at 08:08 PM
This is because X limit wasn't implemented (why ? God knows ...) Here is one I modified few days ago :
 void Update ()
 {
     if (axes == RotationAxes.MouseXAndY)
     {
         rotationX += Input.GetAxis("Mouse X") * sensitivityX;
         rotationX = Mathf.Clamp (rotationX, minimumX, maximumX);
         
         rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
         rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
         
         transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
     }
     else if (axes == RotationAxes.MouseX)
     {
         rotationX += Input.GetAxis("Mouse X") * sensitivityX;
         rotationX = Mathf.Clamp (rotationX, minimumX, maximumX);
         
         transform.Rotate(0, rotationX, 0);
     }
     else
     {
         rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
         rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
         
         transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
     }
 }
Your answer
 
 
             Follow this Question
Related Questions
x, y position to 360 degree 0 Answers
How to disable Mouse Look On Pause Menu. 2 Answers
I am trying to change rows and column to x and z 1 Answer
Character to fly in axis X 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                