Sign in to follow this  
CastorX

Collision Detection and .X files

Recommended Posts

Hy everybody! How can I do the Collision Detection in case of X files? How can I access to the vertices? Is there a good Collision detection library in the D3DX, I couldn't see. THX!

Share this post


Link to post
Share on other sites
Quote:
Original post by CastorX
Hy everybody!
How can I do the Collision Detection in case of X files?

X files describe models - collision detection techniques are relatively independent of the model format used. You typically use bounding volumes (spheres, cylinders, boxes, ellipsoids, etc). With D3DX, you can use the utility functions D3DXComputeBoundingBox and/or D3DXComputeBoundingSphere to get your bounding volumes. There is a number of articles on collision detection and response on GameDev.net. Also, peroxide have a tutorial here. You can head to either the "Math and Physics" forum or the "Game Programming" forum for more details on the math behind it, and implementation strategies, respectively.

Quote:
How can I access to the vertices?

In the documentation page titled "ID3DXMesh Interface", you can clearly see a function named ID3DXMesh::LockVertexBuffer. It does what it says it does.

Quote:
Is there a good Collision detection library in the D3DX, I couldn't see.

There is a precise ray-mesh intersection detection functionality. D3DXIntersect. But it goes down to the triangle level, and is only advisable if:
a) You know that the ray most probably intersects the mesh (via a ray-bounding volume check)
b) You want triangle-precision collision detection.

There are a number of freely available collision detection libraries, by the way. e.g. COLDET.

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