Original Post
Looking at an .x file i can't figure out how to apply the animation in C++
I have 1 triangle of 3 vertices whit 1 bone, to keep is simple
I understand that there are 3 vertices connected to Bone001 (0,1,2), they all weight the same so the amount the vertices change is equel for the 3
But as soon as the 4x4 matrix comes in I'm lost.
I think the 4x4 matrix somehow tells where the bone is inside the mesh
Below the SkinWeights there is this.
What is that 4x4 matrix for? I thought the position of the bone was already in SkinWeights
Below that there is:
I see there are 2 animations, one for the triangle(Animation Anim-Plane001) and one for the bone(Animation Anim-Bone001).
Why are there 2 as it seems that there only needs one?
To change the vertices correctly I assume { Bone001 } points to the bone position.
4 means there is a matrix coming
2 means there are 2 keys, so 2 times a 4x4 matrix
0 means the frame time
16 means that there are 16 variables
So I think I understand some parts of the animation.
But how do I apply the 4x4 matrix to the vertices in C++?
I have 1 triangle of 3 vertices whit 1 bone, to keep is simple
SkinWeights {
"Bone001";
3;
0,
1,
2;
1.000000,
1.000000,
1.000000;
0.753317,0.000000,-0.657658,0.000000,-0.000000,1.000000,0.000000,0.000000,0.657658,0.000000,0.753317,0.000000,30.545536,0.000001,-2.056927,1.000000;;
}
I understand that there are 3 vertices connected to Bone001 (0,1,2), they all weight the same so the amount the vertices change is equel for the 3
But as soon as the 4x4 matrix comes in I'm lost.
I think the 4x4 matrix somehow tells where the bone is inside the mesh
Below the SkinWeights there is this.
Frame Bone001 {
FrameTransformMatrix {
0.753317,0.657658,0.000000,0.000000,0.000000,0.000000,-1.000000,0.000000,-0.657658,0.753317,0.000000,0.000000,2.254292,-21.498741,0.000001,1.000000;;
}
}What is that 4x4 matrix for? I thought the position of the bone was already in SkinWeights
Below that there is:
AnimationSet Anim-1 {
Animation Anim-Plane001 {
{ Plane001 }
AnimationKey {
4;
2;
0;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,-1.000000,0.000000,0.000000,1.000000,0.000000,0.000000,26.617512,-2.959750,0.000000,1.000000;;,
1600;16;1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,-1.000000,0.000000,0.000000,1.000000,0.000000,0.000000,26.617512,-2.959750,0.000000,1.000000;;;
}
}
Animation Anim-Bone001 {
{ Bone001 }
AnimationKey {
4;
2;
0;16;
0.753317,0.657658,0.000000,0.000000,
0.000000,0.000000,-1.000000,0.000000,
-0.657658,0.753317,0.000000,0.000000,
2.254292,-21.498741,0.000001,1.000000;;,
1600;16;
0.985874,-0.167490,0.000000,0.000000,
0.000000,-0.000000,-1.000000,0.000000,
0.167490,0.985874,-0.000000,0.000000,
2.254292,-21.498741,0.000001,1.000000;;;
}
}
}
I see there are 2 animations, one for the triangle(Animation Anim-Plane001) and one for the bone(Animation Anim-Bone001).
Why are there 2 as it seems that there only needs one?
Animation Anim-Bone001 {
{ Bone001 }
AnimationKey {
4;
2;
0;16;
0.753317,0.657658,0.000000,0.000000,
0.000000,0.000000,-1.000000,0.000000,
-0.657658,0.753317,0.000000,0.000000,
2.254292,-21.498741,0.000001,1.000000;;,
To change the vertices correctly I assume { Bone001 } points to the bone position.
4 means there is a matrix coming
2 means there are 2 keys, so 2 times a 4x4 matrix
0 means the frame time
16 means that there are 16 variables
So I think I understand some parts of the animation.
But how do I apply the 4x4 matrix to the vertices in C++?