Hit.ImpactNormal returning odd values

The title says it all, I am just hoping to get confirmation on this. I am attempting to read the ImpactNormal of a hit (from a sphere trace). The returned values are as expected on two sides, yet incorrect on the other two. Below I will include a image of the box that I am tracing, as well as some code. The box image has two X’s which indicate the sides that return incorrect values, the check marks indicate that the normals are being returned as expected.

I set a breakpoint when it was calling MoveComponent and VS was saying that WallImpactNormal was returning {X=2.08616257e-06 Y=1.00000000 Z=0.000000000 }

EDIT:: I should also say that the image shows the world transform, for you guys to test with in the same orientation.

I will try to recreate it later today and get back you to.

Hey PapaBeans,

I spent some time trying to reproduce this issue in a clean, First Person Template project, but I didn’t see any abnormal values in my log for the Impact Normal.

Are you able to see these same results in a clean project? If so, could you please provide a detailed list of steps?

2.08616257e-06 is “scientific notation” for 0.00000208616257

which is pretty close to zero. Likely the cube got rotated away from aligned, then back to aligned, and there’s a tiny, tiny offset from zero in the rotation. In a float, it’s easier to represent very small offsets from zero than it is to represent very small offsets from 1.0: so you are seeing the X’s significant digits as a tiny number, but the Y’s significant digits are essentially 1.0.

You can calculate what the number would be: this is a unit vector, so: xx + yy + zz = 1. so y = sqrt( 1 - xx ) = 0.99999999999782396287

Likely the other face listed as wrong is something like x = -1, y=?e-06

The point being, those values are actually relatively correct. You should almost never compare calculated floats with exact numbers, for this reason. What you expect to be zero or one, may actually have some accumulated error, and be just really, really, really close to the number you expect.