Raycast prints false values when hitting a GameObject located at 0 on the Y-axis
Unity: PhysX
As Designed
2023.2.X
2023.1.X
2022.2.X
2021.3.X
2020.3.X
When working with floating point numbers a little bit of inaccuracy is expected. Getting ±5.677426E-18 instead of an absolute 0 from a complex calculation is well within the tolerated error (which is roughly ±1e-5).
Reproduction steps:
1. Open the attached “Predictkey.zip“ project
2. Open “Main Scene” scene
3. Enter Play mode and double-click in Game view
4. Observe “GetY” value in Console window
Expected result: “GetY” value (i.e. 0) is the same as Y-axis value of Plane GameObject Position (i.e. 0)
Actual result: “GetY” value (i.e. 0) is not the same as Y-axis value of Plane GameObject Position (i.e. -5.677426E-18)