I used the Assimp loader in my DirectX 11 engine to open my .dae model files, but it's not functioning correctly.
My team and I don't believe there are any errors in my code, so I asked others for help. They suggested that there might be an issue with the model itself. I will upload the model files, and I would appreciate it if you could let me know if there are any problems with them.
The issues I anticipate are as follows:
Debugging results show that the values of the base vectors are incorrect. The bone information I was manipulating is in local space, so the expected world position, rotation, and base are not being applied correctly.
This is the code I used to load the model.
void Model::recursiveProcessBoneMatrix(aiMatrix4x4 matrix, const std::wstring& nodeName)
{
const ModelNode* modelNode = FindNode(nodeName);
aiMatrix4x4 transform = modelNode->mTransformation;
if (mParentModel)
{
// Code written to search for nodes with the same name in the model.
ModelNode* parentModelNode = mParentModel->FindNode(nodeName);
if (parentModelNode)
{
/*
Set my hierarchy information based on the parent's corresponding node hierarchy.
Although the model is forced to move to the position of that node,
it causes rotation issues.
*/
Bone* bone = mParentModel->FindBone(nodeName);
if (bone != nullptr)
{
bone = mParentModel->GetBone(bone->mIndex);
matrix = bone->mLocalMatrix;
}
}
}
matrix = matrix * transform;
if (mBoneMap.find(nodeName) != mBoneMap.end())
{
Bone* bone = &mBoneMap.find(nodeName)->second;
aiMatrix4x4 glovalInvers = FindNode(L"Scene")->GetTransformation();
// bone->mOffsetMatrix - vectex to bonespace (like world, view, projection transform)
//matrix - transformed martrix from root
bone->mFinalMatrix = glovalInvers.Inverse() * matrix * bone->mOffsetMatrix;
bone->mLocalMatrix = matrix;
mBones[bone->mIndex].mFinalMatrix = bone->mFinalMatrix;
mBones[bone->mIndex].mLocalMatrix = matrix;
}
for (size_t i = 0; i < modelNode->mChilds.size(); ++i)
{
recursiveProcessBoneMatrix(matrix, modelNode->mChilds[i]->mName);
}
}

