Sign in to follow this  
michael879

writing .x file

Recommended Posts

ok I havnt been able to find ANYTHING explaining how to do this. Ive been searching for days and I asked a question on this forum but I guess it wasnt specific enough, I was just asking for a .x tutorial (nobody gave me one that explained how to do what I want). Im making a 3d tanks game. I want each tank to have 3 parts, the body, the turret, and the cannon. I want to be able to rotate them around 3 seperate "origins" from the program, but I want it so the rotation point is determined by the .x file so that I can just supply it with new .x files and it will work fine. I was thinking I could make each one its own subset so I could give them each their own world matrices but I dont know how to do that inside the .x file. Id also like to put some other information in the .x file that isnt part of the default templates (like speed, or cost). I guess if thats too hard I could just right my own format to load those things. I would like to put two things in the .x file that definatly belong there but Im not sure how to do it. One of them is a bounding shape for collision detection. It would have vertices, normals, and faces so I guess I could just include it in the mesh template or give it its own but I dont know how to put 2 meshes in 1 file and them load them seperately? The other thing is a bounding shape where each face (or vertex, havnt decided yet) contains the mass of that section of the tank (or bullet w/e). Im planning on using this to calculate rotational forces on the tank. any help would be great.

Share this post


Link to post
Share on other sites
typically you do stuff like that with "bones" in the models. You can create bones in any 3D modeling program i've ever seen. Basically different vertices are attached to different bones. Then you just move the bone and the rest of the model moves too. I'm not sure how the .x format implements bones. Normally you'd create the model with bones then save to the .x format.

I don't know how to manipulate .x files or how easy it is to work with skeletal animation stuffs such as this with that format.

[google]: "skeletal animation", ".x file bones", etc

-me

Share this post


Link to post
Share on other sites
Quote:
Original post by michael879
but the other one needs to have masses included.


I'm willing to bet the .x format doesn't support user data like this. If you actually want that stuff in the model instead of defined in data elsewhere, you're going to need to create your own model file format.

-me

Share this post


Link to post
Share on other sites
Yea, it really sucks the big one that MS didn't want to document how to use the ID3DXFile interfaces well, and (much worse) completely changes the interfaces before any one else can explain them. Everyone seems to assume that you will be creating .x files from one of the 3rd party modeling programs. I have done a LOT of searching too on this. You are indeed on your own here. An easy solution would be to save your custom data in a separate file of your making, and only use .x files for the stuff it supports inherently.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this