writing .x file

Started by
5 comments, last by DXnut 17 years, 10 months ago
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.
Advertisement
^bump
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
ah yea I guess bones would work for that. What about the bounding meshes tho? The collision detection one could just be a mesh but the other one needs to have masses included.
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
damn rly? making my own format for simple stuff like speed and cost would be easy but for a variable amount of vectors/faces/normals/masses is gonna be a pain..
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.
--------------------------Most of what I know came from Frank D. Luna's DirectX books

This topic is closed to new replies.

Advertisement