Mesh collisions

Started by
7 comments, last by Asesh 12 years ago
Sb know how to check meshes for collisions? Poly to poly or other variant? If i have X file models?
Advertisement
Cheapest way is to create bounding boxes around each mesh and check for intersections. This wont work if you are rotating the meshes though. In that case, you could use BoundingSpheres.

The best and most accurate way of checking collisions between each mesh is creating a coliision skin around the mesh. Which basically means, recreating the shape of the mesh with as little polys as it takes to be reasonably close
As dAND3h said, the cheapest way is to check bounding volume collisions. You can use either bounding box or bounding sphere according to the shape of your mesh. For example, a box would be best for a television and a sphere for a beach volleyball smile.png


Btw,

This wont work if you are rotating the meshes though.

Why? I think you're wrong. Because we can transform bounding boxes (AABBs) and check them for collisions.

F. Luna's book (Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach; this is available in Google Books) has a good explanation about bounding volumes: creation, transformation and checking.

I think the most accurate way is to create a low-poly version of your mesh manually (i.e. with a 3D modeling software) and send it to your physics engine. There're a lot of physics/collision engines around the net.

hth.
-R
There's no "hard", and "the impossible" takes just a little time.
if bounding boxes are usual boxes with 8 vertexes...so not its not that i need.

physics engine.

maybe this is the best variant...you know maybe any good engines? How about PhysX? Is it work with DirectX?
Physics engines are not designed for a specific graphics library such as DX or GL. Their main goal is to make physical calculations and return final transformations of registered objects/primitives. And your job is to get that transformation data and use for your needs.

PhysX is the most popular physics engine. Now it became free for commercial and non-commercial applications. You can use it. The first important thing you must know about it is that the matrix structure of the engine is column-major but in it's row-major in DX.

On the other hand, Bullet is another popular engine. It's open source and developed by a Sony R&D employee. I know it's used in some animation movies like Toy Story.

hth.
-R
There's no "hard", and "the impossible" takes just a little time.
Bullet physics engine developer now works for AMD. PhysX is much more powerful than Bullet physics and so are it's documentation. D3DX 9 methods can also be used to do so, refer to this old thread of mine: http://www.gamedev.net/topic/615595-solved-transformation-matrices-of-individual-subsets-of-an-x-file/page__p__4886759#entry4886759 to compute bounding box and detecting collisions between two primitives is just a matter of computing coordinates of bounding boxes
BTW, if bounding box is not what you need then you can use bounding sphere too look up D3DXComputeBoundingSphere
But if i use a mesh like a ground? Can Bounding boxes be useful? Maybe i'll need check it Poly to Box, but not box to box...or i don't understand well what is bounding box....
it may be useful if it's a planar surface. You can offset some value off the ground like I have done in that thread and constrain character/camera movement along the coordinate were collision occurred. You should refer to Frank Luna's Introduction to 3D game programming with DirectX 9.0c, it's an excellent book

This topic is closed to new replies.

Advertisement