I'm trying, for many days, to get the Matrix or the Vector3 of my 3D model, I don't want to use the World matrix because I need first to idenfy the axes of my object for animation (= rotation of a second object around my first object).

If you have an idea or a tutorial for this ?

Many thanks,


  • \$\begingroup\$ I'm not sure what you are asking. Are you asking how to get the vertices of your 3D model? \$\endgroup\$ Jul 4, 2011 at 14:29
  • \$\begingroup\$ Do you have the orientation and the position of your model? Now you want to put that in a 4x4 matrix? \$\endgroup\$ Jul 4, 2011 at 14:40
  • \$\begingroup\$ Please elaborate on the problem you are trying to solve. \$\endgroup\$
    – Steve H
    Jul 4, 2011 at 15:48
  • \$\begingroup\$ Sorry to be not very clear, but it's not very clear in my mind.I want to know the orientation, the axis(= means the UP, Right and Forward vector) of my model at any time. Is it possible with Matrix and vector3 ? Thank you in advance Jeangil \$\endgroup\$
    – jeangil
    Jul 4, 2011 at 18:06

2 Answers 2


The "matrix" of an object in model space with no transformations applied is simply:


Similarly the position would simply be:


The "world" matrix is responsible for transforming an object that is in model space into world space.

To make object A orbit object B you could do this with object B's world matrix. Simply apply an appropriate orbit matrix (translation then rotation), followed by object B's world matrix, to object A. This will then be object A's world matrix.

Alternately: you could take object B's world matrix and use the appropriate Matrix properties: Translation to get the position and Forward, Left, Up, etc (MSDN), to get the appropriate axes for constructing the series of transformations to orbit object B.

  • \$\begingroup\$ Thank you, Andrew I am going to read and try what you have sent to me. Jeangil \$\endgroup\$
    – jeangil
    Jul 4, 2011 at 18:11

It sounds like you may be looking for the bone transforms, which define transforms for each mesh in a model relative to the model's coordinate system. This lets you, say, rotate a car wheel about its own axis, and keep it correctly positioned relative to the car chassis.

Assuming that you have already loaded a model with

var model = Content.Load<Model>(@"mymodel") 

You can easily get to the bone transforms with


See this link for a decent explanation, or this one from Riemer's.

This XNA App Hub sample demonstrates loading a tank model, and having its wheels and turret move relative to the model.

The basic idea is that different meshes (in this case, the wheels and tank) are connected via "bones." Bones represent a hierarchical relationship between model elements (despite the name, they are not exclusive to animal or human models).

In your 3D modeling app of choice, you define bones connecting child meshes (wheels) to parent meshes (the tank chassis), and define transforms in the child mesh's space that transform the mesh relative to its parent.

By using the .CopyAbsoluteBoneTransforms() method, you can quickly concatenate the child's transforms with the parent. This has the effect of putting the child mesh in the parent's coordinate space, so that you'll get a valid result when you multiply the result by the view and projection matrices.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .