Sign in to follow this  
Arkanoid

Mesh collisions

Recommended Posts

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

Share this post


Link to post
Share on other sites
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 [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]


Btw,
[quote name='dAND3h' timestamp='1333674353' post='4928641']
This wont work if you are rotating the meshes though.
[/quote]
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

Share this post


Link to post
Share on other sites
if bounding boxes are usual boxes with 8 vertexes...so not its not that i need.
[quote name='programci_84' timestamp='1333689554' post='4928679']
physics engine.
[/quote]
maybe this is the best variant...you know maybe any good engines? How about PhysX? Is it work with DirectX?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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: [url="http://www.gamedev.net/topic/615595-solved-transformation-matrices-of-individual-subsets-of-an-x-file/page__p__4886759#entry4886759"]http://www.gamedev.net/topic/615595-solved-transformation-matrices-of-individual-subsets-of-an-x-file/page__p__4886759#entry4886759[/url] to compute bounding box and detecting collisions between two primitives is just a matter of computing coordinates of bounding boxes

Share this post


Link to post
Share on other sites
BTW, if bounding box is not what you need then you can use bounding sphere too look up D3DXComputeBoundingSphere

Share this post


Link to post
Share on other sites
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....

Share this post


Link to post
Share on other sites
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

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