This project is read-only.

How do I create a collision mesh (or aabb tree)?

Mar 19, 2008 at 10:53 PM
Edited Mar 20, 2008 at 11:01 AM
Pretty new at physics so I don't really know what way to solve the problem below. Hope you can bare with me :)

I have an .X model that I want to use as terrain to drive a vehicle on. It contains different obstacles you should be able to bump into, drive up on etc. Is it possible to add or calculate an collision skin/mesh using the model somehow or is there another/better way of doing it (maybe I should use an created mesh and calculate an aabb tree to use instead)? Would be pretty tedious to do this by handcoding values for primitive objects and aligning them with the model and so on.

Look at the collision skin on this car for example. It doesn't seem to be done by hand but calculated somehow as it's way to detailed (I think).

How can I solve the problem?
Mar 21, 2008 at 5:08 PM
Load your track as triangleMesh - the triangleMesh uses an octtree. deanoc is working on making it faster. Maybe he can tell you more about it.
The car in the video uses two boxes. (its the same as in the demo!)
Mar 22, 2008 at 12:22 AM
The way I use it, is that my content processor exports a triangle list which is then fed into the octree. This gives triangle mesh collision, i've tested upto a little over 300K triangles with reasonable results.

The current octree code however has high memory costs and creation is slow, i've got prototype new one with lower memory and faster to create. I will check in when I'm finished with my other major optimisation (reduction/removal of garbage when running). hopefully this weekend.
Mar 22, 2008 at 9:42 AM
noone88: Nice! Got it working now, seems very nice.

DeanoC: I hear you. An smaller model wasn't much of a problem, but when using a larger one it took a long time to execute and it was pretty nasty on the memory as well. Anyway. I noticed that even if you scale and rotate the model using properties inside Visual Studio the VertexProcessor (if it's that one you're referring to / I'm using that right now) doesn't take this into account and calculates using the original model setup. Is this anything that could be fixed (or is the collision mesh supposed to be calculated in another way)?

Looking forward to the new prototype anyhow, nice work from you guys with this physics engine (I love the architecture) :)
Mar 22, 2008 at 3:52 PM
DeanoC, sounds like you are really doing something for this engine (and of course all xna users), thank you. I don't have the time to work at JigLibX at the moment but in a few weeks again.