Problem using btBvhTriangleMeshShape

btmorex
Posts: 11
Joined: Wed May 23, 2007 12:58 am

Problem using btBvhTriangleMeshShape

Post by btmorex »

Hi,

I just started using btBvhTriangleMeshShape and I'm having a strange problem. I loaded in triangle data for a pyramid made from 8 triangles (4 on the bottom side but we can ignore those since they are flush with the ground plane). I'm using a capsule shape to represent my character. When I climb 3 of the faces everything works as expected. When I move to the 4th face I don't get any collisions and a ray shot down will only register a hit on the ground plane.

Does anyone have any idea what this could be caused by?

I think that actual mesh I'm using is fine because it shows up graphically how I would expect.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Several things can go wrong in the setup.

Can you try one of the following to determine where it goes wrong?

- use btTriangleMesh instead of btTriangleIndexVertexArray

- use btTriangleMeshShape instead of btBvhTriangleMeshShape

- disable quantization

Can you provide a reproduction case in a Bullet demo, or provide all snippets you use to create the btBvhTriangleMeshShape?

Thanks,
Erwin
btmorex
Posts: 11
Joined: Wed May 23, 2007 12:58 am

Post by btmorex »

Erwin Coumans wrote:Several things can go wrong in the setup.

Can you try one of the following to determine where it goes wrong?

- use btTriangleMesh instead of btTriangleIndexVertexArray

- use btTriangleMeshShape instead of btBvhTriangleMeshShape

- disable quantization

Can you provide a reproduction case in a Bullet demo, or provide all snippets you use to create the btBvhTriangleMeshShape?

Thanks,
Erwin
Oops, I was just about to post my code and I realized I was adding triangles to btTriangleMesh wrong (using wrong indices). I'm amazed I got that much functionality w/that bug.
btmorex
Posts: 11
Joined: Wed May 23, 2007 12:58 am

Post by btmorex »

It just occurred to me to ask about btTriangleIndexVertexArray. I'd like to use that instead of btTriangleMesh, but I don't understand quite what the stride parameters represent.

Suppose I have an array of ints for indices and an array of floats for vertices where every 3 represent a vertex.

Would the index stride be sizeof(int)? or 0?
Same for the vertex stride... sizeof(float) * 3? 0? or even sizeof(float)?

What if I'm using 16 bit indices? Do I need to convert them to ints first?