btBvhTriangleMeshShape does not detect collision

Post Reply
lcrivell
Posts: 11
Joined: Sun Jan 10, 2016 5:08 pm

btBvhTriangleMeshShape does not detect collision

Post by lcrivell »

I am building a simple mesh using the following snippet:

Code: Select all

    btTriangleMesh *mTriMesh = new btTriangleMesh();
    btVector3 v0(-1,0,-1);
    btVector3 v1(0,0,2);
    btVector3 v2(1,0,-1);
    mTriMesh->addTriangle(v0,v1,v2);
    btVector3 v3(-1,0,-1);
    btVector3 v4(0,0,2);
    btVector3 v5(1,1,0);
    mTriMesh->addTriangle(v3,v4,v5);
    
    btCollisionShape *colShape = new btBvhTriangleMeshShape(mTriMesh,true);
However, while I see the mesh falling (it starts at higher "altitude"), it traverses the ground.
(I know the rest of my code is working, because if I use a box primitive, it stops at ground level).

Is it normal the btBvhTriangleMeshShape does not detect ground ?
When reading the btBvhTriangleMeshShapedefinition, it states "is a static-triangle mesh shape, it can only be used for fixed/non-moving objects", does static mean that the objects are not moving at all (hence unable to fall) or does it mean that I should not have an external factor influencing the object movement ?
Thanks !
gdlk
Posts: 62
Joined: Fri Oct 24, 2014 7:01 pm

Re: btBvhTriangleMeshShape does not detect collision

Post by gdlk »

Hi!

Just like the description you says, the btBvhTriangleMeshShape is used only to static objects (objects that will never move no matter how much force you apply over them, other way to see them is objects with infinite mass). If you want the object move, you must use another collision shape

This can help you (extracted from http://bulletphysics.org/Bullet/phpBB3/ ... hp?t=10689 )
Image

Regards!
lcrivell
Posts: 11
Joined: Sun Jan 10, 2016 5:08 pm

Re: btBvhTriangleMeshShape does not detect collision

Post by lcrivell »

I went for the btConvexHullShape, thanks !
Post Reply