Problem with large bvhTriangleMeshShape and btBoxShape

rusty
Posts: 25
Joined: Fri Sep 19, 2008 10:23 am

Problem with large bvhTriangleMeshShape and btBoxShape

Post by rusty »

I have a large static world which consists of several large bvhTriangleMeshShapes attached to a compound shape.

I have a rigid body which has a btBoxShape, and the box does not seem to collide with the triangle shape. There doesn't appear to be any sort of callback happening either, as I've added a custom call back and I get nothing.

The static geometry is definitely ok, as ray-casts collide with stuff just fine. Does anybody have an idea what might be the cause of my problem?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Problem with large bvhTriangleMeshShape and btBoxShape

Post by Erwin Coumans »

Which version of Bullet are you using?

Interesting, can you reproduce it in a Bullet demo?

Why do you add them to a compound? It is usually best to add static meshes directly to their own static rigidbody.
Thanks for the report,
Erwin
rusty
Posts: 25
Joined: Fri Sep 19, 2008 10:23 am

Re: Problem with large bvhTriangleMeshShape and btBoxShape

Post by rusty »

Hi Erwin,

I'm using Bullet 2.73.

The reason that I added them to a compound shape, was I guess, that it just seemed the best way to do it at the time. When I was using ODE, it was how I constructed the world collision and I didn't really see a reason to do it any differently.

I'll try creating a bunch of static rigid's and see how it goes. The code that creates the collision world, is fairly modular, so it'll just a few minutes to change.

I haven't tried reproducing this in a Bullet demo as of yet. If I sort this problem with using rigid bodies, I'll spend some time tomorrow trying to reproduce it in a demo and let you know how it goes.

Oh, and thanks for the help!
rusty
Posts: 25
Joined: Fri Sep 19, 2008 10:23 am

Re: Problem with large bvhTriangleMeshShape and btBoxShape

Post by rusty »

It would seem that the problem remains when using static rigid bodies, instead of a compound object. My ray-casts work just fine, but the box still doesn't seem to be colliding with the tri-mesh shape.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Problem with large bvhTriangleMeshShape and btBoxShape

Post by Erwin Coumans »

The btBvhTriangleMeshShape is probably wrongly initialized.

Can you try using btTriangleMesh, and manually copy the vertices into that (instead of using the error-prone btTriangleIndexVertexArray/btStridingMeshInterface directly)?
Hope this helps,
Erwin
rusty
Posts: 25
Joined: Fri Sep 19, 2008 10:23 am

Re: Problem with large bvhTriangleMeshShape and btBoxShape

Post by rusty »

I'm actually using btTriangleMesh already, because of those the error prone nature of the other mesh classes.

It would seem that I've partially sorted the problem. I tried using btSimpleBroadphase instead of btAxisSweep3, and now the box collides with the large triangles meshes without problems. I'm not sure what I'm doing wrong in initializing the meshes to cause btAxisSweep3 to not work. The world extents are big enough to contain the meshes, or at least; they should be.

I'll have to dig a bit deeper to see what the problem is.