Sweep hitting an edge of a flat surface results in wrong normal

For context, I’m making a pawn with custom movement, a box collider and sweep traces for detecting collisions with the world.

The issue is that sometimes when a sweep hits an edge of a mesh (even if it’s flat), the hit result will give a wrong normal. In the image below you can see the mesh with its collision highlighted, the player’s box collision at the point when the issue happens (Hit.Location), and arrows showing the normal vector of the sweep (Hit.Normal). When the sweep hits right at an edge, the normal faces along the wall instead of away from the wall.

A little more info that might be useful:

  • the mesh uses complex collision, built with cube grid and simplified;
  • when exporting the mesh and looking at it in blender, the edge is shared between triangles (it’s not a double edge);
  • this happens along any edge on a flat surface of this mesh, not just the one shown in the image;
  • there are no sweeps that start penetrating (bStartPenetrating is false for this sweep and all further sweeps).