In CMatrix4<T>::getInverse, when to determine whether the determinant of the matrix is zero, the tolerance, ROUNDING_ERROR_32 which is 0.000001f, is too big. Assumpt that one object is scaled to 1/1000, then the transform matrix is {0.001, 0, 0, 0, 0, 0.001, 0, 0, 0, 0, 0.001, 0, 0, 0, 0, 1}, then it's determinant is 1e-9. But it's not zero. Right?
You can test it with scene in which all of objects are scaled to 1/1000. Then use ISceneCollisionManager::getSceneNodeFromRayBB to select one object. The result is that nothing is selected. It's because getInverse is used in getSceneNodeFromRayBB.
But which value is suitable?
Bug in get inverse matrix
That is the problem with having hard-coded tolerance values. The application has no control over the tolerance values used, and the values needed may vary for different uses.
This is also a problem when you scale everything down to 1/1000 of its original size. If your model is 1000 times bigger than you need it, you should probably scale the original model down before using it.
Travis
This is also a problem when you scale everything down to 1/1000 of its original size. If your model is 1000 times bigger than you need it, you should probably scale the original model down before using it.
Travis
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Any suggestions? AFAIK, we can't use FLT_EPSILON, since that falls apart for large or small floats. We could add an explicit comparison method for matrices (and vectors, quaternions) that takes a tolerance. Would that be sufficient, or is there a better fix?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way