# Assimp mOffsetMatrix broken?

This topic is 2526 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've started using Assimp but I can't seem to figure out how to get the position of bones? The documentation says that mOffsetMatrix should be the bone's position relative to the mesh but I can't seem to get the mOffsetMatrix to return the proper result. Now as I understand assimp's matrices are suppose to be right handed like OpenGL but from what I can tell they are not. This is how I'm converting the matrices to my matrix type which is a right handed matrix:

bone->matrix = (*(Matrix44*)&scene->mMeshes[m]->mBones->mOffsetMatrix.Transpose());

However, something is off that I can't quite place a finger on.

##### Share on other sites

I've reviewed your code quite extensively but I don't understand why it's working. From what I can tell I need to iterate backwards through the bone node's hierarchy to construct a global transformation. However, I had actually already tried this but failed to receive any logical results. Maybe you can see what I have done wrong?

 aiNode* bnode = scene->mRootNode->FindNode(scene->mMeshes[m]->mBones->mName); aiMatrix4x4 GlobalTransform = bnode->mTransformation; aiNode* parent = bnode->mParent; while( parent->mParent != scene->mRootNode ) { GlobalTransform *= parent->mTransformation; parent = parent->mParent; } bone->matrix = (*(Matrix44*)&GlobalTransform.Transpose());

##### Share on other sites
I belive your are mutliplying in the wrong order. When I load the matrix from assimp on the init function, i transpose everything in the copy. Then, after the copy is finished, I build the skeleton. In your code . .

GlobalTransform *= parent->mTransformation;

Then, you transpose afterwards. Right handed and left handed matrix operations are backward from each other. Try transposing all your matrix before you do any calculations., otherwise, change the order of mutiplication to be backwards, i.e
GlobalTransform = parent->mTransformation * GlobalTransform ;

##### Share on other sites

I belive your are mutliplying in the wrong order. When I load the matrix from assimp on the init function, i transpose everything in the copy. Then, after the copy is finished, I build the skeleton. In your code . .

GlobalTransform *= parent->mTransformation;

Then, you transpose afterwards. Right handed and left handed matrix operations are backward from each other. Try transposing all your matrix before you do any calculations., otherwise, change the order of mutiplication to be backwards, i.e
GlobalTransform = parent->mTransformation * GlobalTransform ;

I forgot to reply back to you. That was the problem and I had quickly figured it out. Thank you for all your help! I really appreciate it!

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633769
• Total Posts
3013758
×