How do I get all the objects within a bounding box?

Post Reply
ET3D
Posts: 4
Joined: Sun Oct 21, 2007 11:53 am

How do I get all the objects within a bounding box?

Post by ET3D »

Subject says it all.

Thanks!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: How do I get all the objects within a bounding box?

Post by Erwin Coumans »

ET3D wrote:Subject says it all.

Thanks!
That is not easy at the moment. I'll add a helper method to the broadphase for this.

Thanks,
Erwin
reltham
Posts: 66
Joined: Fri Oct 12, 2007 6:28 pm
Location: San Diego

Re: How do I get all the objects within a bounding box?

Post by reltham »

Hopefully you can do helpers for other bounding volumes besides box.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: How do I get all the objects within a bounding box?

Post by Erwin Coumans »

It will only report objects that have axis aligned bounding box (AABB) overlap.

The broadphase only deals with AABBs, this is extremely efficient.

If you need more precise bounding volume, you will need to take the resulting pairs from the broadphase query, and do more culling yourself, using one of the existing narrowphase queries. We can add some wrappers for this functionality.

Thanks,
Erwin
reltham
Posts: 66
Joined: Fri Oct 12, 2007 6:28 pm
Location: San Diego

Re: How do I get all the objects within a bounding box?

Post by reltham »

I'm just starting to delve into this stuff and I'm not familiar with everything, so I apologize for asking for something that didn't really make sense in the system. In a couple weeks I'll be much more familiar with it as I work on integrating collision into our project.

Anyway, I know that one thing I we want to be able to do is query for all objects that are inside or touching a given sphere and/or capsule.
DevO
Posts: 95
Joined: Fri Mar 31, 2006 7:13 pm

Re: How do I get all the objects within a bounding box?

Post by DevO »

So actually you need some kind of Volume sensor that detect all bodies inside convex volume?

I think this would be great if Bullet will get Sensor support.
Volume Sensor, Ray Sensor.

One question is how to get firs object from Bullet word that will be intersected by the ray ???
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: How do I get all the objects within a bounding box?

Post by Erwin Coumans »

Yes, this will be added for Bullet 2.64. Ageia calls this Sensor, Havok calls this Phantom, Bullet calls it querySingleObject.
One question is how to get firs object from Bullet word that will be intersected by the ray ???
You can use world->rayTest, see Bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h. Note that btDynamicsWorld is derived from btCollisionWorld, so you can just use your dynamics world to perform the rayTest:

Code: Select all

/// rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback
/// This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback.
void	rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback, short int collisionFilterMask=-1);
You can see the picking code in Bullet/Demos/OpenGL/DemoApplication.cpp, or the Raytracer demo how to use the raytest.
Thanks,
Erwin
reltham
Posts: 66
Joined: Fri Oct 12, 2007 6:28 pm
Location: San Diego

Re: How do I get all the objects within a bounding box?

Post by reltham »

Did this ever get put in?

I'm having issues with querySingleObject not returning any results if the start and end points are the same (or very near each other).
Post Reply