ODE and terrain/world collisions

Started by
2 comments, last by Sphet 17 years, 1 month ago
I'm just getting started using ODE and I am having difficulty deciding on what approach to take with terrain and world collisions. The documentation to ODE doesn't provide any real world examples to work with. I have a world which is divided into an octree with each cell containing a polygon soup. I also have buildings in the world which have been BSP'd into leafs with more polygon soup. The question is what is the best method for getting ODE to perform collision detection given this arrangement? I know that using a heightmap or some other mathematical function for generating terrain would simplify collision detection, but I'm currently using a Q3/HL2 style level editor which doesn't support that. There's still the problem with what to do about the stuff in the BSP tree. Any recommendations would be appreciated.
Advertisement
From my memory, ODE has some support for trimeshes through Pierre Terdiman's OPCODE library. This stuff works (I think??) but isn't going to do the BSP system. You'll need to write a BSP collider for ODE; one for each part of entities you want to support - BSP vs sphere, BSP vs OBB, BSP vs Capsule.

I've written ODE colliders before but never BSP ones. Not sure if there is anything out there - quick google search found nothing.

My suggestion, if your maths are good, is to find or write a BSP collider for ODE. It's easier for you since your object is static, so you don't need to worry about dynamics for a BSP, only for the object colliding with the BSP (which would be handled by ODE).

Alternatively you can just use the trimesh stuff, and see if you can convert the BSP to a trimesh, but be warned: BSPs use planes for the most part, so it may not be efficient enough as triangles.

If you have a trimesh system working, you can use ODEs spatial partitioning to put each octnode into a partition grid so it doesn't get collided against if nothing is in it.
I haven't tried the trimesh yet. I'm just getting started with ODE so the only thing I've tried so far is very simple bouncing boxes off of a geom plane.

I was thinking that a custom collider(s) would be necessary to handle this situation. I would like to avoid brute-force poly to poly collision as much as possible.

I think I read somewhere that the OPCODE library is now part of ODE, but the docs aren't clear.
Quote:Original post by InetRoadkill
I haven't tried the trimesh yet. I'm just getting started with ODE so the only thing I've tried so far is very simple bouncing boxes off of a geom plane.

I was thinking that a custom collider(s) would be necessary to handle this situation. I would like to avoid brute-force poly to poly collision as much as possible.

I think I read somewhere that the OPCODE library is now part of ODE, but the docs aren't clear.


InetRoadKill, you certainly do want to avoid brute-force poly v poly. In most games, characters are usually represented by a bounding volume, sometimes a sphere, a box or a capsule. I've always used capsules because they have decent properties that make them fast and can be used to reflect the size of a character pretty well. You'll want to find a way to collide a capsule against your data - in this case a BSP. I've never written this so it's not my domain of knowledge to help you, but I do know that you'll need to if you want your characters to collide with your level.

This topic is closed to new replies.

Advertisement