Adding generated non-convex shapes in real-time

User avatar
JohnJ
Posts: 9
Joined: Tue Feb 26, 2008 6:24 pm
Location: California

Adding generated non-convex shapes in real-time

Post by JohnJ »

I'm finally getting around to the stage where I need to integrate physics into my game engine since my last post on here, and my original question is still unanswered, probably because I wasn't specific enough. Here's my question:

How can I add non-convex collision shapes (which are chunks of terrain from my planet rendering engine) to Bullet as efficiently and quickly as possible? I don't want any preprocessing or validation being done on them because this would be unnecessarily slow, since real-time loading of these shapes is absolutely performance-critical (it should be able to load a 32x32 terrain chunk in under a few milliseconds, optimally).

I'm hoping there's a way I can provide a raw vertex / index / triangle buffer for direct use by Bullet.

Edit: Also, if there's currently no way to do what I need, maybe there's a way I can modify / extend Bullet to do so?

Edit #2: BTW, I'd normally research this myself, but the reason I ask here is because I can't find any good documentation on using Bullet or how Bullet works - the manual is nice but doesn't cover everything, and the API documentation seems to be almost nonexistent besides a few one-line descriptions thrown at Doxygen. Maybe I'm looking in the wrong places?
fullmetalcoder
Posts: 29
Joined: Mon May 19, 2008 5:01 pm

Re: Adding generated non-convex shapes in real-time

Post by fullmetalcoder »

Unless I misread your post btStridingMeshInterface is exactly what you need. It allows you to re-use graphical data (indices/vertices) to perform physics. You can create convex or concave trimesh using this interface. The code of btTriangleIndexVertexArray should help you to write your own subclass of striding mesh interface.

Note : I managed to write such a subclass but all my attempts at making collision work with convex/concave trimesh loaded this way failed miserably so far so it might not be the best way...
User avatar
JohnJ
Posts: 9
Joined: Tue Feb 26, 2008 6:24 pm
Location: California

Re: Adding generated non-convex shapes in real-time

Post by JohnJ »

Thanks for the reply. btStridingMeshInterface sounds like what I want, though that's strange that you're having problems getting it working.