- Home /
 
              This question was 
             closed Apr 17, 2015 at 09:12 AM by 
             zwoxy for the following reason: 
             
 
            Found a better way to do this
 
               Question by 
               zwoxy · Apr 16, 2015 at 06:12 PM · 
                rotationeulerangles  
              
 
              Can I convert an eulerangle with negative values to the corresponding positive values?
I have an object that rotates to an eulerangle using Vector3.Lerp. the target the player can add or subtract another vector3 from the target vector by pressing a button, causing the object to rotate a certain number of degrees. but when the player adds or subtracts to many times so the target vector contain negative values or values over 360, the objects starts to spin out of control. is there a way to translate for example Vector3(0,-10,0) to Vector3(0,350,0) or Vector3(0,370,0) to Vector3(0,10,0)?
               Comment
              
 
               
              you can normalize angles between 0 and 360 using modulo arithmetic (%)
 float angle;
 angle = angle  % 360;
 if (angle < 0) {
     angle += 360;
 }
 
                 Thank you, I found a better way though. I just converted the euler angles to a quaternion and lerped to that ins$$anonymous$$d.