Sign in to follow this  
InetRoadkill

ODE and terrain/world collisions

Recommended Posts

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.

Share this post


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

Share this post


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

Share this post


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

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