linmath WARNING?

:linmath(warning): Tried to invert singular LMatrix3.

When I run my code, the above warning shows every frame in the console. But my code runs well. What’s wrong?

Thanks a lot!

I had that error too lately, when I scaled a DirectGUI to a negative value.
Try to isolate the error to a certain part of the code.
It’s a warning, not an error. So it should run fine anyway.

A matrix that scales to 0 in any axis is a singular matrix. This is a perfectly valid matrix, but you can’t invert it, since that’s basically like dividing by zero.

Many of Panda’s normal scene graph operations require inverting the matrix. For instance, computing the relative transform between two nodes requires a matrix inversion. Similarly, computing the bounding volume around a DirectGui element requires a matrix inversion. Rotating a billboard to face the camera requires a matrix inversion. Testing a collision volume for intersection requires a matrix inversion. The list goes on.

Thus, if you put a node in the scene graph that has a scale to 0 in any axis, you are liable to see warnings like this. There are other ways to get that warning too, but most of them involve a scale to 0.

Basically, the lesson is, don’t scale things to zero. Scale them very small instead, for instance to 0.001. That’s usually good enough to have the same effect, without the bad juju that comes along with scaling it all the way to zero.


Yes, I scaled the GUI object down to 0 in Y axis. Now I assiagn a positive number to that, the warning does not show again! Thanks! :smiley: