Jump to content
  • Advertisement
Sign in to follow this  

Multiple Meshes

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a question about how to keep multiple meshes together. I have 3 meshes, pieces of a tank, and i want them all to be able to move independently but want them all to stay with the tank. right now i just have a vertical distance and horizontal distance that are from the tank bottom and they carry the same rotation. I am wondering if there is a better way because right now i have to translate each piece individually and they are not staying with the tank bottom real well. And suggestions are greatly appreciated. Thanks in advance. Zwig

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You could use an ID3DXMatrixStack to manage the hierarchy of parts within the tank for you: one matrix representing the tank base, with child matrices representing the turret and possibly the tracks. The child matrices represent rotation/translation relative to the base.

When you need to render the tank, transform the child parts into the space of their parent (i.e. the tank base), then transform the whole lot normally.

Share this post


Link to post
Share on other sites
Hello all. This is my first post.

I like the question and the answer alike.

Personally, I was unfortunately not aware of the matrix stack facility, so I did it "by hand" programmatically.

Here's the jist of what I did:

Create the matrix for each mesh separately (doing translation and rotation).

Then multiply the matrix of each child object with the matrix of the parent, e.g., the turrent to the tank body.

And then if there's a child to a child, combine that 'grandchild''s matrix to the child's matrix, which is combined to the parent's matrix. (E.g., the hand to the arm to the body). And so on.

And finally, create a class or procedure which automates the process and allows for greater flexibility, recursion, etc.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!