Static `btConvexHullShape` Not Participating in Collisions

Post Reply
Geometrian
Posts: 25
Joined: Sat Dec 03, 2011 8:37 pm
Contact:

Static `btConvexHullShape` Not Participating in Collisions

Post by Geometrian »

I'm trying to make a simple square static pyramid collision object. It seems I'm supposed to do this with `btConvexHullShape`:

Code: Select all

btConvexHullShape* shape = new btConvexHullShape;
shape->addPoint(btVector3(-1,-1,0));
shape->addPoint(btVector3( 1,-1,0));
shape->addPoint(btVector3( 1, 1,0));
shape->addPoint(btVector3(-1, 1,0));
shape->addPoint(btVector3( 0, 0,1));
I then construct rigid body, etc., the same way I do for every other static object in the scene. In the debug renderer, I can see the pyramid in the correct place (albeit not every edge is present; seems to be a known issue). However, pyramid objects do not seem to detect collisions at all! Other objects seem to be just fine.

Are convex hulls supported for static geometry? If not, why didn't this crash, and what should I use instead for such a simple primitive? If it is supported, why isn't this working and what should I be doing?
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Static `btConvexHullShape` Not Participating in Collisions

Post by drleviathan »

btConvexHullShape does work, so I would expect something else is wrong. Does the object properly collide when you supply it with a different shape but leave all other code unchanged?
Geometrian
Posts: 25
Joined: Sat Dec 03, 2011 8:37 pm
Contact:

Re: Static `btConvexHullShape` Not Participating in Collisions

Post by Geometrian »

Does the object properly collide when you supply it with a different shape but leave all other code unchanged?
Replacing it with a box, I saw that collisions failed there too. Comparing that with my working box code, I was able to trace it down to a problem with the transforms—specifically, the transforms had a scale baked in, which I had already figured out doesn't work. After applying the scale to the object instead, I was able to get the collisions correct.

Thanks for the good debug idea!
Post Reply