Bone animation: calculate matrix of a child.

Recommended Posts

Hi, I'm new to bone animation and I'm confused about calculating a matrix of a child(bone).

Let's say, I have a pelvis bone(root) and a spine bone(child to root).

I have a rotation for each(pelvis and spine) in Quaternion.

for pelvis(root), what I did is multiplying 4x4 matrix of quaternion with its' coordinate to calculate a local transform.

and for spine, I did the same.

So in order to find the world matrix of the spine(child), should I do local transform matrix of pelvis * local transform matrix of spine?

Share on other sites

I dont quite get you, but i think you want to rotate spine by its own local axis.

So first thing to do is that you place not rotated pelvis and not rotated spine in proper positions, then you get the vector from pelvis rotation pivot point to spine rotation pivot point.

Then to actually rotate the spine along with pelvis rotation.

You have rotation matrix of pelvis, and local rotation mattix of spine, now you translate spine so the rot pivot point of spine is at 0,0,0 then you apply spine rotmat then you translate back to original position then you should multiple vector computed earlier by pelvis rot mat then i think you combine those two matrices by multipkying them, its wuite harf to say cause it seems i deleted the code that actually did that and found something like this

Where ship would be your pelvis and right boardside is your spine and ship is centered at 0,0,0 point and right boardside resides where it should

for (int i=0; i < ship_count; i++)
for (int j=0; j < ship[i]->boardside_cannon_cnt; j++)
{

vec3 rotpos = ship[i]->ROTATION_MAT * ship[i]->right_boardside[j].pos;

Matrix44<float> wrld;
wrld.TranslateP(rotpos + ship[i]->pos);
MVP = (wrld * ACTUAL_VIEW) * ACTUAL_PROJECTION;

}}

I could twist something

Create an account

Register a new account

• Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 12
• 9
• 11
• 15