Jump to content
  • Advertisement
Sign in to follow this  
GENTS

Bounding Box - IN - X file parsing

This topic is 5147 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

Hi guys! I'm back on this forum again with collision problems... But now my problems begin earlier!!! I know how to parse an .X file, how to catch out X frames matrices but I don't know how to compute a bounding box around each frame! I want to load a level in my game and parsing its X file, I want to compute a bounding box around each object (frame), but I don't know how to do that! I kwon how to create a bounding box of an complete object, but I want to create lots of bb around all its parts... How to do that?! Can I extract from each frame the mesh (if exist) and from it create a bb for the same mesh?! How can I do that?! Have you got any tutorial?! Or code samples?! Thanks for help!!! Byez, [Edited by - GENTS on September 14, 2004 5:20:18 AM]

Share this post


Link to post
Share on other sites
Advertisement
There's a D3DX method/utility called D3DXComputeBoundingBox(). Use it right when you load your mesh, and you should be able to store a bounding box that contains it.

If you use that box again later the find the mesh's current bounding box, be sure to transform the bounding box by the same matrices you used to transform your 3D object.

I believe there are numerous SDK examples that contain this and D3DXComputeBoundingSphere().

Share this post


Link to post
Share on other sites
Use the IDirectXFile and IDirectXFileData interfaces to process the .x file data. You can load from each subset separately and calculate your BB. Use the GetNextObject and GetData members to get each frame's root mesh node and children.

Share this post


Link to post
Share on other sites
The Frugal Gourmet:

probably you've not understood my problem... I don't want a unique bb, but a bb for every frame of my X file...

enigma1:

yes, I've get the idea! Thanks... Could you post me some code or link to tutorial's page?!

THANKS!!!

I hope I'm not annoying you!!!

Share this post


Link to post
Share on other sites
To be honest, the !!!!!'s are annoying. Try to use less of them and it won't feel like you're screaming at everyone.

You can also store the bounding mesh (could be a box, could be a sphere, could be a complex mesh) in the X file and store it as a separate name. Then when you load it, you know that it's your bounding mesh.

I'm a little confused why you need a bounding mesh for each frame. Could you comment on that a little? It also depends on what you use the frames for. Are you using them as a bone heirarchy and you want to have a bounding box around the arms, legs, body, etc.? Or something else?

Thanks,
Chris

Share this post


Link to post
Share on other sites
there is an article in GameDev that comes close to what you are looking for I think. (see the implementation page too)
http://www.gamedev.net/reference/programming/features/skinmesh/page2.asp

If you can also do what Chris said precalculate the BB it will also be faster for your render computations.

source link:
http://www.gamedev.net/reference/programming/features/skinmesh/source.zip

hope it helps

Share this post


Link to post
Share on other sites
ok sorry for !!!

Supernat02:

I don't want to fill my .X file more than it is 'cause dimensions could be a problem...
So I'm trying to load a complete level, a mesh with walls, terrain, holes and some barrels... my level has no bones, so I've not bones matrices, but only frames matrices...
Now I want to create a bb around every piece of wall, one for terrain and one for every barrel, 'cause my level is closed and I'm in the inner part of it (ex: a room or a lot of rooms)...
I know how to get every frame by name or by looping through them, but I don't know how to pick out their world position, matrices and how to compute bb around every mesh of every frame...

I hope its almoust clear... Sorry for my bad english!

enigma1:

Thanks for the link; I'll look at it and I'll try to find a solution...


THANKS!

Share this post


Link to post
Share on other sites
no help in that article... my meshes aren't skinned meshes and that's is the problem...
I've not bones matrices to figure out and to create bounding box around them, so how can I do?!

Byez,

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!