Page 1 of 1
Convert world transform matrix to local for joint
Posted: Thu Sep 13, 2018 1:32 pm
by mant
I'm integrating an animation framework to Irrlicht. It provides a global matrix and I need to convert to local matrix for Irrlicht to use.
Because the local matrix from the 3rd-party doesn't work.
Have anyone done this before?
Re: Convert world transform matrix to local for joint
Posted: Fri Nov 02, 2018 6:39 am
by chronologicaldot
I assume you're talking about the SkinnedMesh. Line 818 of CSkinnedMesh.cpp is CSkinnedMesh::calculateGlobalMatrices(). Here you'll see that the joint's global matrix is calculated by multiplying it's parent global by the local. So to get the local, you have to do it in reverse: Multiply the global matrix for the joint that you have by the inverse of the parent joint global. You'll have to set the parent joint global first (if there is a parent joint).