I don't get the warning

When I use the line below, it doesn’t give a compiler warning. Does that mean the 2019 version doesn’t have that issue?
if (period == 0) movementFactor = 0f;

Hi Zack,

No, you did everything correctly.

Mathf.Epsilon is useful if you calculated with floats, e.g. if you divided two floats. Since all decimal types (float, decimal, etc.) in programming are unprecise, it is likely that you get an unprecise result. The expected result could be 0 but the calculated result could be almost 0.

Since we do not calculate anything here but assign a value to period, it’s fine to simply compare it to 0.

Has your question been answered?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms