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?
Inaccuracies while trying to implement box select
-
- Posts: 6
- Joined: Thu Aug 02, 2012 12:40 am
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Inaccuracies while trying to implement box select
I would suggest using the broadphase AABBs to perform the test, there is an API for that.
-
- Posts: 6
- Joined: Thu Aug 02, 2012 12:40 am
Re: Inaccuracies while trying to implement box select
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?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Inaccuracies while trying to implement box select
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
See https://github.com/erwincoumans/bullet2 ... t.cpp#L910