btBvhTriangleMeshShape questions

Post Reply
hynner
Posts: 6
Joined: Sun Aug 14, 2011 11:23 am

btBvhTriangleMeshShape questions

Post by hynner » Sun Aug 14, 2011 4:24 pm

Hi, I´m completely new to Bullet, and I´m having some troubles with Bullet. So if I have btDiscreteDynamicsWorld and some Rigid Bodies in it with btBvhTriangleMeshShape it cannot interact with each other, it means, there is no collision detection between them, no dynamics, etc. And another "problem" is that if I have for example the box shape and it collides with something, the direction and rotation of the box is changed, but if I throw the box towards the triangle mesh it only moves but no rotation. So if anyone can give me some explanation I would be very glad, as I said I´m complete newbie.
PS: Sorry for my English.

argez
Posts: 6
Joined: Wed Jul 27, 2011 5:18 pm

Re: btBvhTriangleMeshShape questions

Post by argez » Sun Aug 14, 2011 4:49 pm

Maybe i am wrong but i think generic triangle meshes such as the btBvhTriangleMeshShape can only be used with static bodies (rigid bodies with a mass of 0). So you can not collide 2 object of this type together.

For your dynamic bodies, always use simple collision shapes like spheres, boxes and so on. If you need more complex shape, use the compound shape to join multiple simple shapes together.

hynner
Posts: 6
Joined: Sun Aug 14, 2011 11:23 am

Re: btBvhTriangleMeshShape questions

Post by hynner » Sun Aug 14, 2011 5:06 pm

Oh, I didn´t know that, thx, but I´ve used btBvhTriangleMeshShape with mass, it only gived me assertion when i tried to calculate local iternia. So there is there isn´t any way to use triangle mesh shape for movable object? I´m just looking into Bullet manual, and I see that for movable object I can use Convex Hull shape which wouldn´t be so big problem for me, as I don´t need completely perfect shape, but when I tried it, it can collide with each other, but still there is problem with no rotation applied when two convex hull shape collide. Can it be solved anyhow simple, or this is only usable for very simple shapes?

Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: btBvhTriangleMeshShape questions

Post by Flix » Mon Aug 15, 2011 6:50 am

For full dynamic concave shape support, you may want to use btGImpactMeshShape, or btCompoundShape + some convex decomposition tool (basically a compound made by many btConvexHullShapes). You may look at appGImpactTestDemo and appConvexDecompositionDemo.
If concavity is not required, you can use a simple btConvexHullShape.

As for the rotation problem when two btConvexHullShapes collide, it simply shouldn't happen; so make sure everything is done in the correct way (use some Bullet demo as a reference). Expecially make sure that the local inertia gets correctly computed and used, and that you're not adding a rigid body to the world twice (in case you use the DemoApplication::localCreateRigidBody(...) helper method of the demos, that already adds the body to the world for you).

hynner
Posts: 6
Joined: Sun Aug 14, 2011 11:23 am

Re: btBvhTriangleMeshShape questions

Post by hynner » Mon Aug 15, 2011 7:11 am

Yes, calculateLocalInertia did the work, thank you. Now I have another question, is it possible to have dynamics on animated mesh? I´m using Ogre and btOgre wrapper which have some animatedMeshToShapeConverter, but it seems it has to be somehow updated, which I haven´t figured out yet, so is there any chance to have animated mesh in Bullet or it has to be recreated each time before stepSimulation call?

Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: btBvhTriangleMeshShape questions

Post by Flix » Wed Aug 17, 2011 10:37 am

hynner wrote:Now I have another question, is it possible to have dynamics on animated mesh? I´m using Ogre and btOgre wrapper which have some animatedMeshToShapeConverter, but it seems it has to be somehow updated, which I haven´t figured out yet, so is there any chance to have animated mesh in Bullet or it has to be recreated each time before stepSimulation call?
No idea, and I'm not familiar with btOgre and animatedMeshToShapeConverter too.

I suggest you simply use the same collision shape behind your animated mesh (and maybe you can slightly modify it on some occasions, but not every timestep).

If this is not enough for you, I got no clue about it.

Post Reply