for a while I’ve been getting this error in the Output Log and I have failed to figure out why.
It just appears seemingly randomly.
LogUnrealMath: Error: TMatrix::InverseFast(), trying to invert a NIL matrix, this results in NaNs! Use Inverse() instead.
LogUnrealMath: Error: TMatrix::InverseFast(), trying to invert a non-invertible matrix, this results in NaNs! Use Inverse() instead.
Also once after editor startup and starting PIE, I get this:
Just a guess, but looks like a view matrix or something associated with the camera. To invert a matrix, the determinant needs to be non zero. So if it has NaNs or is zero, you’ll get this error. But I’m not sure why it would need an inverse. Usually, the inverse is used when you click on the screen and you want to know what asset is under the mouse. Are you doing any line traces (based on screen coordinates) or anything like that (getting 3d position under mouse) when your game starts? Or anything that takes screen coordinates and converts to world 3d coordinates? Or a widget or decal that is based on the center of the screen (or any screen location) and you’re trying to project that into the scene? ANYTHING that goes from screen to 3d world coordinates? That’s where I’d start looking.
I’m guessing you’re not building the engine from source or you would have debug info and could see the names of the functions, correct?
Thanks for the reply!
I have finally found the solution after narrowing it down for 2 hours.
It was related to static meshes I was spawning!
I would’ve never thought that static meshes could be the culprit.
When opening the folder that contained the meshes in the content browser I would also get the error in the output log.
Reimporting them also didn’t fix it.
Then I got this error message:
LogStaticMesh: Warning: The difference between RenderData Bounds (Origin=X=0.000 Y=0.000 Z=0.000, BoxExtent=(X=0.000 Y=0.000 Z=0.000), SphereRadius=(0.000000)) and MeshDescription Bounds (Origin=X=2538.330 Y=5881.262 Z=-136.763, BoxExtent=(X=2538.330 Y=1311.599 Z=3328.858), SphereRadius=(4382.041629)) is significative for StaticMesh /Game/Meshes/EnemyBase/Enemy_Base_Ring_3_Variant_2.Enemy_Base_Ring_3_Variant_2
So in the end I completely deleted them from the project and re-imported them from FBX, now it works.
Crazy!
For anyone having the same issue, it seems like meshes you are using in your world can get corrupted. Simply mousing over corrupted meshes in content folder will cause this error.
The fix is very easy. Open then broken mesh, and check Nanite→Preserve Area checkbox. Click Apply Changes button below.
This didn’t help me. I’m not using Nanite, but tried it anyway, to no avail.
This has been happening for some time in our projects, possibly since moving to 5.5. Aside from the NIL matrix / NaNs error, I’ve discovered that the easiest way to find these corrupted meshes is to filter the Content Browser by Static Meshes, change the view to Columns, and sort by the UVChannels value. All the corrupted meshes seem to have 8 UV channels instead of 1.
I’m using Max but I believe we’ve had this problem with Blender meshes as well, from a couple of different members in the team. So far I haven’t found a way to fix such assets (tried various export options from the 3D software and various import options in UE), the only workaround is to import the model as a completely new asset and replace references.