Designing and using a mesh with many subsets

I am trying to design a nice robot model in 3ds max and export it as an x-file, so I can use it.

That is fairly easy, but the problem is that when I design and position the various sub elements, they are stored in the xfile with vertices in the subobjects local coorinatesystem (which is good), but when I call mesh.drawSubset, the transformation matrix, which positions the subobejcts relative to eachother in the world, is used automatically.

That might have been a bit unclear, but the problem is this. I have a box with its center at 0,0,0 and a size of 200 in all three directions. On one of its corners (at 100,100,100) I have another box, and that other box has its model space center at 100,100,100. The other box has a size of 20 in all directions.

That is stored in an xfile and the first box has a transformmatrix which is the identity matrix, since its model space is identical to the world. The other box has a matrix which moves its center to 100,100,100. This means that if i call drawSubset for the two, they end up the right places, BUT....

If i want the small box to sit in the corner of the other and rotate, then I have a problem. I should rotate the box before the transform matrix moves it. If not then the box rotates arround the world center and not its own center.

How do I control when the transformationmatrix from the xfile is being used? It seems that it is being used before the worldtransform that I specify. Or simply... how do I make the small box sit in the corner of the other and rotate arrount its own (small box') center?

[1597 byte] By [ThomasGreenleaf] at [2007-12-24]
# 1

What you need is a hierarchy tree of matrix with animation key in a x file

You will define frame (matrix) that are stack like a skeleton (child and sibling matrix)

Your animation key will animate this skeleton (that can include only 2 bones/frame/transformation-Matrix if you want)

Animation key will move those frames/matrix/bones that can be influencing each other or be side by side (sibling matrix)

in the hierarchy

Now this hierarchy of matrix will move with the animation key in the X file

You will also need to attribute each vertex of your drawing with one of those matrix/bone/frame

The first 8 vertex would be associated with matrix1

The other 8 vertex of the smaller cube will be associated with matrix2

Matrix2 is a combination of matrix1 and matrix2 that can be one on top of the other like a forearm of a robot

This combined matrix is cumulative and you need to do this yourself

when you read a hierarchy tree in a X file

It's a very complex subject but that's what you should look for :-)

That's how it's done...look for D3DXLoadHierarchyFormFile type of function...

Etienne2005 at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: Graphics...
# 2

I am sorry that I formulated the question so vague. I am not making animations in the 3d-design program. Just the models, which I later want to mode based on my simulation.

Now I realize that the approach is all wrong anyway. I should not design the different objects as a whole and then later move certain parts. I should make a number of different objects and then put them together in code.

ThomasGreenleaf at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: Graphics...