What Is a Model Bone?

A model bone is a matrix that represents the position of a mesh relative to other bones in a 3D model.

Dd904249.Model-ModelMesh(en-us,XNAGameStudio.31).png

In the XNA Framework, the Model class represents the whole model. The Model contains a ModelMesh for each separate mesh in the model. Each ModelMesh contains a ParentBone, which controls the mesh's position and orientation relative to the model. The Model has a Root bone, which determines the model's position and orientation. Every ModelBone can have one parent and many children. The Root bone on the Model object is the ultimate parent. Its children are bones on ModelMesh objects—objects which might have other ModelMesh bones as their children, and so on. In any given family of bones, rotating the parent bone also rotates the children, and their children, and so on.

Every bone has a transformation matrix (called Transform) that defines its position and rotation relative to the position of the parent bone. This rotation and translation applies to all the vertices in the ModelMesh (for example, all the vertices that connect to that bone). To animate a bone, you multiply the default bone transform by a new matrix. When you draw the ModelMesh, you then base your world matrix on the bone's transform.

The easiest way to incorporate transformed bones into drawing is to use the CopyAbsoluteBoneTransformsTo method. This method takes the bone transforms, which are relative to each other, and iterates over them to make them relative to the Root bone of the Model. Then it returns a copy of these transforms. When you draw each ModelMesh, you can use the absolute bone transform as the first part of your world matrix. This way you won't have to worry about parent bones and their relationships.

Community Additions

ADD
Show: