For box selection (frustum collision)

Salb
Posts: 4
Joined: Sun May 01, 2011 11:57 pm

For box selection (frustum collision)

Post by Salb »

I would like to use bullet for box selection (AKA rubber band selection) of objects. I have read in other posts that you can do frustum culling via the broadphase class, but no explanation was offered. I just want to test against a frustum and see what objects are inside, how do I go about it?

Thanks in advance.
Carl
Posts: 7
Joined: Wed Oct 27, 2010 3:11 pm

Re: For box selection (frustum collision)

Post by Carl »

Hello,

I successfully did this following the following steps

construct a frustum from your area selection
add the frustum points to a btConvexHullShape
set the btConvexHullShape for a ghost object via setCollisionShape
dispatchAllCollisionPairs for the ghost objects
loop through the manifold for your collisions

hope this helps
Carl
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: For box selection (frustum collision)

Post by Flix »

Nearly two years ago, I did something similiar to Carl's solution here (source code added): http://bulletphysics.org/Bullet/phpBB3/ ... um+culling.

The source code for doing frustum culling via the broadphase is contained inside the demo called CDTestFramework (it should be shipped with the Bullet distribution). It requires extracting the frustum planes each frame (in an appropriate format) and feeding them to some broadphase methods. It works only with the btDbvtBroadphase.