Need help using btBvhTriangleMeshShape

jorrit
Posts: 13
Joined: Mon Jul 18, 2005 7:16 am

Need help using btBvhTriangleMeshShape

Post by jorrit »

Hi all,

I want to create a rigid body using a general triangle mesh instead of a primitive. I think btBvhTriangleMeshShape is the class I should use but it is unclear to me how I should use it. None of the demos is using this class as far as I can see. Is there some example code?

Greetings and thanks,
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Need help using btBvhTriangleMeshShape

Post by Erwin Coumans »

jorrit wrote: I want to create a rigid body using a general triangle mesh instead of a primitive. I think btBvhTriangleMeshShape is the class I should use but it is unclear to me how I should use it. None of the demos is using this class as far as I can see. Is there some example code?
The concave triangle mesh (btBvhTriangleMeshShape) only supports static/non-moving world environment. See ConcaveDemo or VehicleDemo how to use this.

For _moving_ rigid bodies, Bullet only support convex meshes (btConvexHullShape or btConvexTriangleMeshShape), or a combination (btCompoundShape) of convex meshes and primitives (similar to Havok, Ageia PhysX). This means manual or automatic convex decomposition to break a concave mesh into a compound of convex meshes. See Bullet/Demos/ConvexDecompositionDemo.

If you really want to use moving concave meshes, you can use the btGImpactShape, using GIMPACT extension, which is part of the Bullet distribution. See the MovingConcaveDemo or GImpactTestDemo how to use it.

For what cases do you want to use moving concave meshes?
Thanks,
Erwin
jorrit
Posts: 13
Joined: Mon Jul 18, 2005 7:16 am

Re: Need help using btBvhTriangleMeshShape

Post by jorrit »

I have no specific case but having generic mesh rigid bodies is part of our physics api so I can assume that people are using it in some cases. I'm just implementing our physics API and this is part of it.

Greetings,
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Need help using btBvhTriangleMeshShape

Post by Erwin Coumans »

Can you use btGimpactShape for moving concave meshes then? It has a similar API then btBvhTriangleMeshShape.
For non-moving static 3d world environment, can you still use btBvhTriangleMeshShape?

Can you add a convex mesh to the Crystal Space rigid body API? It is a very useful collision shape, although the performance gain is best for meshes with less then 128 vertices (Bullet assumes the user make a little bit of effort to optimize collision shapes).

Open Dynamics Engine (ODE) doesn't support convex meshes, so you can use concave meshes to support such new feature.

Thanks,
Erwin
jorrit
Posts: 13
Joined: Mon Jul 18, 2005 7:16 am

Re: Need help using btBvhTriangleMeshShape

Post by jorrit »

Well that would require extending our api which is possible. But in any case, the general case of moving concave meshes also has to be supported.

Greetings,
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Need help using btBvhTriangleMeshShape

Post by Erwin Coumans »

jorrit wrote:Well that would require extending our api which is possible. But in any case, the general case of moving concave meshes also has to be supported.

Greetings,
Can we add such feature request? I think it is good to encourage users to make more efficient use of the rigid body API. It would be best to also add convex mesh support to your content pipeline. Blender 3D modeler has a feature to flag meshes as 'convex' as supposed to concave, and its COLLADA Physics exporter also supports this.

Do you use Blender for Crystal Space? Can you consider to use the collision bounds type from Blender? Blender allows you to mark the collision bounds as sphere, box, cylinder, cone, convex mesh or concave triangle mesh.
But in any case, the general case of moving concave meshes also has to be supported.
Sure, that is what the btGimpactShape is for. Is it possible to use btBvhTriangleMeshShape for non-moving static triangle meshes, and only btGimpactShape for moving rigid bodies in Crystal Space?

Thanks,
Erwin
jorrit
Posts: 13
Joined: Mon Jul 18, 2005 7:16 am

Re: Need help using btBvhTriangleMeshShape

Post by jorrit »

Erwin Coumans wrote: Can we add such feature request? I think it is good to encourage users to make more efficient use of the rigid body API. It would be best to also add convex mesh support to your content pipeline. Blender 3D modeler has a feature to flag meshes as 'convex' as supposed to concave, and its COLLADA Physics exporter also supports this.
Doesn't have to be a feature request. I will work on this immediatelly.
Do you use Blender for Crystal Space? Can you consider to use the collision bounds type from Blender? Blender allows you to mark the collision bounds as sphere, box, cylinder, cone, convex mesh or concave triangle mesh.
No, we don't use Blender in CS itself. But blender2crystal has support for physics primitives. When we extend our physics api with convex meshes then it is a simple matter of adding the right support in blender2crystal.
But in any case, the general case of moving concave meshes also has to be supported.
Sure, that is what the btGimpactShape is for. Is it possible to use btBvhTriangleMeshShape for non-moving static triangle meshes, and only btGimpactShape for moving rigid bodies in Crystal Space?

Thanks,
Erwin[/quote]

yes, that's what I plan to do. When mass=0 I plan to use the static version and when mass>0 I will use btGimpactShape.

Greetings,