Page 1 of 1

Inaccuracies while trying to implement box select

Posted: Thu Oct 13, 2016 4:19 am
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?

Re: Inaccuracies while trying to implement box select

Posted: Thu Oct 13, 2016 2:02 pm
by Erwin Coumans
I would suggest using the broadphase AABBs to perform the test, there is an API for that.

Re: Inaccuracies while trying to implement box select

Posted: Thu Oct 13, 2016 11:10 pm
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?

Re: Inaccuracies while trying to implement box select

Posted: Fri Oct 14, 2016 1:25 am
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