Jump to content
  • Advertisement
Sign in to follow this  
SteveDeFacto

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
you can download my ASSIMP animation exporter, maybe that will help you out
http://nolimitsdesigns.com/game-design/open-asset-import-library-animation-loader/

Share this post


Link to post
Share on other sites

you can download my ASSIMP animation exporter, maybe that will help you out
http://nolimitsdesig...imation-loader/


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 this post


Link to post
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 this post


Link to post
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!