Page 1 of 1

Static `btConvexHullShape` Not Participating in Collisions

Posted: Thu Apr 28, 2022 1:35 am
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?

Re: Static `btConvexHullShape` Not Participating in Collisions

Posted: Thu Apr 28, 2022 3:28 pm
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?

Re: Static `btConvexHullShape` Not Participating in Collisions

Posted: Fri Apr 29, 2022 7:44 am
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!