diff --git a/source/Irrlicht/CSkinnedMesh.cpp b/source/Irrlicht/CSkinnedMesh.cpp index 75e2ca64..07e86d6b 100644 --- a/source/Irrlicht/CSkinnedMesh.cpp +++ b/source/Irrlicht/CSkinnedMesh.cpp @@ -1347,9 +1347,24 @@ void CSkinnedMesh::recoverJointsFromMesh(core::array &jointChil { IBoneSceneNode* node=jointChildSceneNodes[i]; SJoint *joint=AllJoints[i]; - node->setPosition(joint->LocalAnimatedMatrix.getTranslation()); - node->setRotation(joint->LocalAnimatedMatrix.getRotationDegrees()); - node->setScale(joint->LocalAnimatedMatrix.getScale()); + + if ( joint->UseAnimationFrom ) // Seems to work better (else solution seems to mess up sometimes) and would be faster. Any disadvantage? + { + node->setPosition(joint->Animatedposition); + core::quaternion qrot = joint->Animatedrotation; + qrot.W *= -1.f; // Animation system uses right-handed rotations? Argh... + irr::core::vector3df euler; + qrot.toEuler(euler); + euler *= core::RADTODEG; + node->setRotation(euler); + node->setScale(joint->Animatedscale); + } + else + { + node->setPosition(joint->LocalAnimatedMatrix.getTranslation()); + node->setRotation(joint->LocalAnimatedMatrix.getRotationDegrees()); + node->setScale(joint->LocalAnimatedMatrix.getScale()); + } node->positionHint=joint->positionHint; node->scaleHint=joint->scaleHint;