Weird problems with Triangle mesh + GImpact

Lambda
Posts: 2
Joined: Wed Apr 03, 2013 11:38 pm

Weird problems with Triangle mesh + GImpact

Post by Lambda »

Hello there,

I choosed bullet as the physics engine for the game engine im building, however im having some weird issues.

The test scenario is just a box acting as a container and 100 small boxes spawning each half second with a random linear velocity.

The static ground is made of a btBvhTriangleMeshShape and the boxes are btGImpactMeshShape, the problem is that some boxes simply doesn't even collide with the walls and they scape from them and the ones that don't they act weird, as an example they don't collide with other boxes, you can see them intersecting other boxes, there's also the constant jitter movement that never stops and honestly i have no idea of what to do in order to fix it since the (lack) of documentation doesn't say much about it.

I've made a video to show the behavior, the red lines are the bullet debug wireframe view.

http://www.youtube.com/watch?v=g4ywZoKMCCg

I hope you guys can help me, probably is just something stupid but i can't seem to get it working right,

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

Re: Weird problems with Triangle mesh + GImpact

Post by Erwin Coumans »

It is better to use a btBoxShape or btConvexHull, because gimpact is not very reliable and there is no CCD (continuous collision detection) support for those shapes.

As an alternative, you can convert the gimpact mesh to a tetrahedralization using the following API
defined in the header file src/BulletCollision/Gimpact/btCompoundFromGimpact.h

Code: Select all

btCompoundShape*	btCreateCompoundFromGimpactShape(const btGImpactMeshShape* gimpactMesh, btScalar depth)
If you use small convex shapes (btConvexHullShape for example) you can enable CCD, see Bullet/Demos/CcdPhysicsDemo for an example.
This won't work for gimpact or concave shapes (such as btCompoundShape)
Lambda
Posts: 2
Joined: Wed Apr 03, 2013 11:38 pm

Re: Weird problems with Triangle mesh + GImpact

Post by Lambda »

Erwin Coumans wrote:It is better to use a btBoxShape or btConvexHull, because gimpact is not very reliable and there is no CCD (continuous collision detection) support for those shapes.

As an alternative, you can convert the gimpact mesh to a tetrahedralization using the following API
defined in the header file src/BulletCollision/Gimpact/btCompoundFromGimpact.h

Code: Select all

btCompoundShape*	btCreateCompoundFromGimpactShape(const btGImpactMeshShape* gimpactMesh, btScalar depth)
If you use small convex shapes (btConvexHullShape for example) you can enable CCD, see Bullet/Demos/CcdPhysicsDemo for an example.
This won't work for gimpact or concave shapes (such as btCompoundShape)
Thanks for the quick answer but the file you referenced doesn't exists in my bullet code, i'm using the latest released version, is this something that only exists in the dev version?

EDIT: I've been testing by using CCD and Convex Hulls and the results are satifactory, cubes now collision with each other without intersections (when one fals on top of a bunch of them they spread to let the new one take space) however, the issue of cubes falling through the walls still persists, i tried by increasing the amount of triangles in the container mesh by creating a sphere really detailed but they still sometimes slip from the walls, any ideas?

Thanks.