How do I setup a matrix for my joints?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
n00bc0de
Posts: 38
Joined: Tue Oct 04, 2022 1:21 am

How do I setup a matrix for my joints?

Post 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?
CuteAlien
Admin
Posts: 9651
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

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

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply