I was an honour and a privilege to look into this for someone so busy and important.
Zeroth wrote:EDIT: If you comment out "scene::IBoneSceneNode* parentBone = characterNode->getJointNode("RHand");" the problem doesn't occur. It seems as if the source of the problem is the getJointNode function.
That's down to it calling
CAnimatedMeshSceneNode::checkJoints(). This should (IMHO) really be called automatically, since it's necessary to generate the real joint transformations. You could take this up with Luke if you're feeling feisty.
Here's the (apparent) root problem, in the source .X file:
Code: Select all
Frame Bip01_L_Toe0 {
FrameTransformMatrix {
0.000000,0.000000,1.000000,0.000000,-0.000000,1.000000,-0.000000,0.000000,-1.000000,-0.000000,0.000000,0.000000,2.075310,-0.000000,2.518657,1.000000;;
}
A matrix[2] value of 1.000000 (expressed as 1.0000006f) gives a rotation of NaN in
CMatrix4<T>::getRotationDegrees(). This produces a cascade of NaN bad karma that results in a NaN ray in the collision test, which collides with any box.
Root cause: bad model.
We should probably detect and log it, and bail out of the loading at that point:
Code: Select all
Index: source/Irrlicht/CXMeshFileLoader.cpp
===================================================================
--- source/Irrlicht/CXMeshFileLoader.cpp (revision 1567)
+++ source/Irrlicht/CXMeshFileLoader.cpp (working copy)
@@ -666,6 +666,12 @@
readMatrix(mat);
+ if(core::equals(mat(0, 2), 1.f))
+ {
+ os::Printer::log("A Transformation Matrix contains a value that will result in an invalid rotation", ELL_WARNING);
+ return false;
+ }
+
if (!checkForOneFollowingSemicolons())
{
os::Printer::log("No finishing semicolon in Transformation Matrix found in x file", ELL_WARNING);
Alternatively, we could correct a value of 1.f to (e.g.) 0.f and hope for the best.