I can't understand my question, too.
but help me.
I want {1.5f , 4.5f} to {1 , 3}
ex) {0.5f , 2.5f} to {1 , 5}
I want to change float to integer value.
Is there a useful function in this situation?
CodePudding user response:
In fact you do not want to normalize, you want to divide by x.
var vec = new Vector2(.5f, 1.5f);
vec /= vec.x;
Debug.Log(vec); // (1.0, 3.0)
CodePudding user response:
You can multiply all your case with 1/(first case) like:
my_array = [1.5, 4.5, ...]
coef = 1 / my_array[0]
for i in range(1, len(my_array)):
my_array[i] = my_array[i] * coef
CodePudding user response:
For your situation here,
You could always set your X
to 1
, and then your Y
value would become Y / X
this would only work when X
is a factor of Y
however.