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.
For box selection (frustum collision)
-
Carl
- Posts: 7
- Joined: Wed Oct 27, 2010 3:11 pm
Re: For box selection (frustum collision)
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
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)
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.
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.