Inaccuracies while trying to implement box select

Post Reply
jeff
Posts: 6
Joined: Thu Aug 02, 2012 12:40 am

Inaccuracies while trying to implement box select

Post by jeff »

I'm attempting to implement box selection of objects. I've created a btCollisionWorld, and I'm calling contactTest() with a btConvexHullShape constructed from the corners of the selection box unprojected to the camera's near and far planes.

Now, if I place the first corner of the selection box just on the edge of an object, the object will flicker between being selected or not as I drag the other corner of the selection box around. Any suggestions for eliminating this behavior? Or is there a better approach I should be using?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Inaccuracies while trying to implement box select

Post by Erwin Coumans »

I would suggest using the broadphase AABBs to perform the test, there is an API for that.
jeff
Posts: 6
Joined: Thu Aug 02, 2012 12:40 am

Re: Inaccuracies while trying to implement box select

Post by jeff »

Are you referring to btDbvt::collideKDOP(), which looks like it would let me test the frustum created from the box selection against the AABBs of the objects in the scene?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Inaccuracies while trying to implement box select

Post by Erwin Coumans »

Yes. There is some old project that had really nice occlusion culling option, base on this.

See https://github.com/erwincoumans/bullet2 ... t.cpp#L910
Post Reply