- Home /
 
Problem with getting constructional slope angle.
 void EulerToAngle()
     {
         eulerAngleX = currentObject.transform.eulerAngles.x;
         eulerAngleY = currentObject.transform.eulerAngles.y;
 
         float curRotX = currentObject.eulerAngles.x;
         float curRotY = currentObject.eulerAngles.y;
 
         float InversedX;
         float InversedY;
 
         if (curRotX > 0 && curRotX < 90)
         {
             InversedX = Mathf.InverseLerp(0, 90, curRotX);
             angleX = Mathf.Lerp(0, 90, InversedX);
         }
         if (curRotX > 90 && curRotX < 180)
         {
             InversedX = Mathf.InverseLerp(90, 180, curRotX);
             angleX = Mathf.Lerp(90, 0, InversedX);
         }
         if (curRotX > 180 && curRotX < 270)
         {
             InversedX = Mathf.InverseLerp(180, 270, curRotX);
             angleX = Mathf.Lerp(90, 0, InversedX);
         }
         if (curRotX > 270 && curRotX < 360)
         {
             InversedX = Mathf.InverseLerp(270, 360, curRotX);
             angleX = Mathf.Lerp(90, 0, InversedX);
         }
 
               This code shows me correct constructional angle, except the cases when angle is right, half full... For example when Euler angle is 359 or 1 the constructional angle is 89. The problem appears when Euler is 360/0,270,180,90 and show 0 or 9 degrees.
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
How can I detect the angle of the platform the player is on? 1 Answer
Unity, walking up small steps with rigidbodies 2 Answers
Tilt character when rotating 0 Answers
Euler angles have a dead zone near 90? 2 Answers
Sliding game slope jittering. 0 Answers