Answer the question
In order to leave comments, you need to log in
How does Unity compare two floats for inequality?
I compare heights from two vectors3 for the fact of inequality. what will happen to the comparison if one of the heights loses accuracy?
Answer the question
In order to leave comments, you need to log in
instead of comparing the height values, compare the modulus of their difference with the error of interest, for example:если модуль(a - b) < 0.0005 -> a равно b
Vectors are usually subtracted from each other and the sqrMagnitude of the resulting vector is compared with the epsilon, also sometimes magnitude is taken , which is more expensive in calculations, but sometimes gives more accurate results.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question