Convert world transform matrix to local for joint

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
mant
Posts: 125
Joined: Sun Jan 27, 2013 3:38 pm

Convert world transform matrix to local for joint

Post 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?
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: Convert world transform matrix to local for joint

Post 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).
Post Reply