• 10
• 12
• 12
• 14
• 18

# Skeletal model display/calculatation problems

This topic is 4480 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I am at the moment testing rendering a skeleton from an SMD file, but things aren't going so smoothly. The following is my code which sets up (or attempts to) the matrices for each bone -

for(Count = 0; Count < NumBones; Count++) {
D3DXMatrixIdentity(&Matrices[Count]);

D3DXMatrixRotationYawPitchRoll(&TempMatrix, RotX, RotY, RotZ);
Matrices[Count] *= TempMatrix;

D3DXMatrixTranslation(&TempMatrix, PosX, PosY, PosZ);
Matrices[Count] *= TempMatrix;

if(Bones[Count].Parent > -1) {
Matrices[Count] *= Matrices[Bones[Count].Parent];
};
};


The following information is written in the SMD specification - <PosX> <PosY> <PosZ> is the position in world units (good to 6 significant digits). <RotX> <RotY> <RotZ> are local Euler rotations in radians. Bones which are not children of the world report their position and rotations in their parent's local space. I have tried re-arranging virtually everything I can think of (as my matrix maths isnt too good trial and error gets a good look in) and i have gone from results that look like a complete mess to some that have looked to be close, but with the odd joint or 2 pointing off in the wrong direction giving the skeleton a deformed look. Is there any obvious mistake in the above code, or have I not taken something into account from the spec? Here is a screenshot of mine (on the outsides) versus milkshape 3D (on the inside) to illustrate - Skeleton Thanks Zak