questions about collision detection

fullmetalcoder
Posts: 29
Joined: Mon May 19, 2008 5:01 pm

questions about collision detection

Post by fullmetalcoder »

I am getting frustrated with Bullet collision detection.
I created a small demo using Irrlicht and Bullet and managed to create basic objects (spheres and boxes), apply gravity and other forces to them and make collide with each other. However, as soon as I try to add some complex objects (trimesh) may it be terrain or characters, collision just does not work with them (I tried using both btBvhTriangleMeshShape and btConvexTriangleMeshShape in combination with both a custom btStridingMeshInterface and btTriangleMesh).

Do I need to register extra collision algorithm or use some tricks in the physics setup code or do a little more than stepSimulation() in my physics update function?

thanks in advance
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: questions about collision detection

Post by sparkprime »

You should probably say what is happening to your triangle mesh rigid bodies and what you expected to happen.
fullmetalcoder
Posts: 29
Joined: Mon May 19, 2008 5:01 pm

Re: questions about collision detection

Post by fullmetalcoder »

my tri mesh are loaded properly (at least I don't get weird messages or assert failures) but the rigid bodies (and thus their graphical representation do not collide.

For instance if I fire a sphere (the equivalent to cubes used in most bullet demo...) at a cube or sphere they collide but I I fire a sphere at a terrain (generated from heightmap by the 3d engine and loaded as a convex or concave trimesh as far as bullet is concerned) no collision occurs... The smae thing happens with characters and any other mesh I tried so far...

Does this explanation help?
AlexSilverman
Posts: 141
Joined: Mon Jul 02, 2007 5:12 pm

Re: questions about collision detection

Post by AlexSilverman »

Have you set up debug rendering so that you can be sure your trimesh is in fact being created properly? If so, then I would suggest putting the mesh into one of the Bullet demos. If the problem still exists, then we can go from there and see what is happening.

- Alex
fullmetalcoder
Posts: 29
Joined: Mon May 19, 2008 5:01 pm

Re: questions about collision detection

Post by fullmetalcoder »

How do I setup debug rendring? I've tried using btDiscreteDynamicsWorld::debugDrawWorld() but it did not display anything (not even the objects that collide properly...)
AlexSilverman
Posts: 141
Joined: Mon Jul 02, 2007 5:12 pm

Re: questions about collision detection

Post by AlexSilverman »

Hi,

You need to define your own debug drawer class, using the btIDebugDraw interface, so the code will use whatever method Irrlicht needs to render a line. Then you can register the class you made with the dynamice world you're using (most likely btDiscreteDynamicsWorld). I'll double check when I get to work to see if there are any gotchas I'm missing, but I believe that's all there is to it.

Hope this helps.

- Alex