# trouble getting correct transforms for multiple meshes from assimp importer

I have had excellent success in extracting almost everything i need from a collada file that i imported with assimp, however I am struggling to get the correct transforms for each mesh in the file. Each individual mesh has correct vertex data but is not transformed relative to the others.

At first I thought my issue was that I simply wasn't applying the hierarchy of transforms for the meshes, and i read http://www.assimp.org/lib_html/data.html based on an answer from another thread and implemented the void CopyNodesWithMeshes function that is given in pseudo-code there. However I have found that this didn't help as each mesh is a child of the root node and has only the identity matrix transform for the root and each of the mesh nodes (thus the combined transform for each mesh is identity also). The hierarchy in the scene appears as follows :

           sceneRoot (identity)
|
-------------------------------------------------
|               |                  |            |
Mesh0           Mesh1           Mesh2           Skeleton
(identity)      (identity)      (identity)      |
------------
|    |   (etc)....
(not identity)


There is no reference in the Skeleton to any of the mesh nodes as far as i can tell. I have also extracted the skeleton and bones for animation and they work but each mesh is simply at my origin since i cannot extract their transforms.

So i tried to load the model directly with assimp viewer and the 3 meshes load correctly from the model file and are in their correct relative positions. I even tried to step through the loader code of assimp viewer and as far as i could tell it was getting identity matrix transforms just as i was for the 3 meshes from the sceneNode hierarchy. But somehow assimp manages to render the 3 meshes correctly.

I am stumped at this point - does anyone know what i might be missing here?

Thanks

I am calling the following from assimp

const aiScene* scene = aiImportFile (fullpath, aiProcess_Triangulate
| aiProcess_FlipWindingOrder);


And using the following code that i wrote to extract the combined transform for each mesh (though it doesnt do me any good since i get the identity transform for each):

//based on pseudocode of assimp http://www.assimp.org/lib_html/data.html
void CopyNodesWithMeshes(const aiScene* scene, aiNode* node, Matrix& accTransform)
{
Matrix transform;
Matrix nodeTrans;
convertAssimpMatrix(nodeTrans, node->mTransformation);
//transform = node.mTransformation * accTransform;
multiplyMatrix(transform, nodeTrans, accTransform);

// if node has meshes, create a new scene object for it
if( node->mNumMeshes > 0)
{
//new SceneObject
SceneObj& so = s_sceneObjs[s_numSceneObjs];
so.numMeshes = node->mNumMeshes;
for (int i=0; i < node->mNumMeshes; ++i)
{
so.mesh[i] = scene->mMeshes[node->mMeshes[i]];
}
s_numSceneObjs++;
assert(s_numSceneObjs < eMaxSceneObjs);
memcpy(&so.transform, &transform, sizeof(so.transform));

}

// continue for all child nodes

for (int i=0; i < node->mNumChildren; ++i)
{
CopyNodesWithMeshes(scene, node->mChildren[i], transform);
}
}