Advertisement Jump to content
Sign in to follow this  

loading 3D meshes for collision...

This topic is 4673 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 folks, I want to do some ray / mesh collision detection. I have the mesh in a 3ds format, but can put it in just about any format. Anyone know a library that does collision detection which will read in the meshes? Working in VC++. Cheers -Al

Share this post

Link to post
Share on other sites
Hm, you posted tons of information, probably you are doing a software renderer in year 2006?

In case you are using Direct3D (9.0c) it is pretty simple:
- Convert you 3ds mesh to .x
- Load it with D3DXLoadMeshFromFile
- use D3DXMeshIntercept function (i believe it is called so)

Once your mesh is loaded, you just simply tell two points, from where till where you would like to go. If there is a face inbetween, this function will tell you, how further you can go. For example if there is a wall in front of you (4 meters), and you would like to go 10 meters forward, it will return in that direction you can go only 4 meters - and - which face you are colliding with.

On the same principles the games Tomb Raider and "God of War" (PS2) are working - there is a making of. They simply made 2 copies of meshes in Maya: one is the original game scene, and the other is the simplified scene for collision detection.

In case you are using OpenGL it will get much harder but still is possible. All you need is a math library with plane/ray calculations and perhaps collision with triangles - in this case you do not have to do nothig, just the intercept check.

Share this post

Link to post
Share on other sites
Hi Samurai Jack,

Thanks for the reply - yes reading it my question was a bit on the light side!

Here is a little more info:

I am not rendering any of this - I just want to output the coords of the collision.

It is a rather large dataset, but should get all into memory.

I dont have two points, but have a origin and direction. Is their a directx function to handle this?

I will read a bit more about those directx functions you mentioned.



Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!