Single vertex collision shape?

Post Reply
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm
Contact:

Single vertex collision shape?

Post by dphil »

I have a ghost cube that should detect which of various moving rigid spheres are inside it (the spheres float around and may or may not be colliding with the cube at any given time). For me, a necessary and sufficient condition of being considered "inside" is that the centre of the sphere is inside the cube. So basically I want the ghost cube to detect collisions with the spheres' centres, not the spheres themselves. Thus, I suppose I have to attach an additional collision object/shape (ideally a single vertex) to each sphere representing its centre? In this case, which collision shape does one use for a single vertex? btBU_Simplex1to4 seems like a candidate, but its documentation suggests to use btConvexHullShape instead. Though I'm not sure if a btConvexHullShape is well-defined with a single vertex.

Any thoughts are appreciated, thanks.
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Single vertex collision shape?

Post by Mako_energy02 »

I think a btConvexHullShape would work. Worst case you can add some extra points to the same position and I can almost assure you that would work. I've seen that as a bug before where someone had a loop adding points but wasn't incrementing the iterator to the next Vector3 properly, so what came out was objects colliding with a single point. Alternatively you could use a zero-radius sphere. That one I don't have as much experience with but the margin should get added to it making it more or less safe to set at zero.
Post Reply