How to convert User Values into degree(Angle)??

Hi Friends,

I am trying to get values from a InputField and based on that do the rotation.
But here the challenge is: the user will type values from 0 to 100 and the 3D gameobject should rotate 0 to 90 degrees only, means if the user types 100 in the inputField, the target object should be rotated to 90. Likewise from 0-100 Values to 0-90 degree. How to implement this??


this is really simple maths :slight_smile:

so you want 0-100 to be a percentage of 0-90.

float angleRef = (90/100)

then when you select the input its

float angleToRotate = angleRef * userInput; //or whatever you called it
transfom.eulerAngles = new Vector3(0,angleToRotate,0);

or whatever method you are using to rotate the object

Hi bubzy,

Thanks a lot for the answer… I also tried a bit similar to yours like following


for an example, if the user input is 100, (100/100)*90=90 so the object rotates to 90.