Bullet Plane Question

Hello. How do you make a plane in bullet that doesn’t extend to infinity? Like only making the plane get covered at a particular point.

Planes, I’m afraid, are defined as being infinite.

If you wand more limited coverage, then you might be better off with a “box” shape. (Or a polygonal shape, although that might be less reliable if you just want a square.)


1 Like

@Thaumaturge, can I use the following box constructor to make what I want?

shape = BulletBoxShape(Vec3(5, 5, 0))

Hmm… I don’t know how Bullet would react to having a zero extent in one (or more) of the dimensions of a box-shape. It seems like a bad idea, to me–something that’s likely to cause problems.

In any case, I imagine that it gives up the greatest advantage that a box-shape has over a polygonal shape: that it has volume, and is thus more reliable.

I’d suggest either giving the box somewhat of a z-extent, or just using a polygonal shape.

If a box doesn’t have the shape that you want…

The general form for a “plane” shape that is bounded by additional “planes” (really better called “half-spaces”, because a plane really just divides space into a solid and a non-solid half) is a “convex hull”, implemented by BulletConvexHullShape. A convex hull is the intersection of multiple planes. A box is a specific form of the convex hull (consisting of six planes at right angles from each other). It takes a number of points and the shape is defined as the result of tightly shrink-wrapping around those points. Note this way of defining it implies that it must be completely finite. I’m also fairly sure that it will require a non-zero volume, so you’d need to add one or more points extending downward.

You can use this to, for example, make a (convex) polygon shape that is extruded downwards for some distance (giving it volume, like a prism). Just add all the polygon’s points to it in no particular order, and add them again but with a lower z value.

Unlike Panda’s collision system, Bullet doesn’t have a “polygon” shape. The closest thing to such a zero-volume shape would be BulletTriangleMeshShape.

1 Like

Indeed, it was perhaps somewhat vague of me to refer to a “polygonal shape”–to be clear, what I was referring to was a “triangle mesh shape”, I believe.