Raycast hitpoint y is -2.235174E-08

Situation:

I’m doing a raycast from my main camera to my groundplane.
The groundplane is positioned just below the 0,0,0 plane. (it has a height of 1 and is positioned at -0.5y).
Now when I request the hitinfo point and print it in debug is
says for example (25.6, 0.0, 45.6 )
This is what I would expect…
But if I use this point as a goalposition for a moving unit for example , the y value keeps on changing even though this should stay zero because the unit starts at y=0 and move to y=0;

After some debugging I found out that when I print in debug the y-value of the vector3 hitinfo point it does not say 0.0 as in the vector3 printout but instead -2.235174E-08 (=-infite?)

How can I solve this?

-2.235174E-08 is not -infinite.

It’s actually 0. Well not exactly but it’s

-2.3 * 10^-8    == 0.000000023

Such values are the result of floating-point-inaccuracy.

edit
Just in case you don’t know, the above number (-2.235174E-08) is represented in scientific notation. You should be able to read this notation when you program :wink:

This for example is valid C#:

float f1 = 2.5E-03F; // The same as 0.0025F
float f2 = 2.5E03F;  // The same as 2500F