Question by 
               Mikzalianz · Sep 24, 2019 at 07:38 PM · 
                rotationclamplimitmathf.clamptransform.rotate  
              
 
              How to clamp transform.Rotate values?
Hi folks! My problem is simple but somehow I am feeling a bit tricky to solve it. I am using transform.Rotate to rotate my gameobject with Input.GetMouseButton Controls.
Following is the code. I have applied the rotation but now I need to apply limit to my rotation.
 Vector3 mPrevPos = Vector3.zero;
 Vector3 mPosDelta = Vector3.zero;
 
 void Update()
 {
        if (Input.GetMouseButton(0))
         {
                 RotateObject();
         }
 }
 
 void RotateObject()
     {
         mPosDelta = Input.mousePosition - mPrevPos;
         transform.Rotate(transform.up, -Vector3.Dot(mPosDelta, Camera.main.transform.right), Space.World);
     }
Now, kindly someone can tell me how to clamp its values.
PS: I have searched many answers and tutorials. Still my fat brain could not figure it out.
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                