Page 1 of 1

How do I setup a matrix for my joints?

Posted: Sun Nov 12, 2023 10:18 pm
by n00bc0de
I have asked some similiar questions to this but this is more specific to how to setup a matrix after I have the position and orientation calculated.

So I have position of each joint and I have the direction that joint should be facing in. When I output the positions of each joint before adding keys, they are correct. Once I add a single key the joints position seem to completely change. I just added a key with no rotation and the joints completely change.

Is there a simpler way built-in to irrlicht for setting up the matrix if I have a vector for each bone position and a quaternion for the direction that bone is rotated to?

Re: How do I setup a matrix for my joints?

Posted: Mon Nov 13, 2023 11:21 am
by CuteAlien
You can convert Irrlicht quaternion (core::quaternion) to matrix using the getMatrix function. Just make sure the quaternion you got has the same rotation (left handed in Irrlicht since 1.8). Otherwise you'll need getMatrix_transposed.
And position can be passed along in same getMatrix function as parameter. If you have already set the position matrix earlier you can pass getPosition from your existing matrix back to this function. As position is independent from rotation so you can also set it afterwards for the same matrix if you created one from quaternion earlier.