Page 1 of 1

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

Posted: Mon Oct 22, 2007 5:32 pm
by ET3D
Subject says it all.

Thanks!

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

Posted: Thu Oct 25, 2007 7:29 am
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

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

Posted: Fri Oct 26, 2007 10:59 pm
by reltham
Hopefully you can do helpers for other bounding volumes besides box.

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

Posted: Fri Oct 26, 2007 11:14 pm
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

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

Posted: Sat Oct 27, 2007 12:29 am
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.

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

Posted: Sat Oct 27, 2007 11:56 am
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 ???

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

Posted: Sat Oct 27, 2007 5:45 pm
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

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

Posted: Thu Apr 10, 2008 12:50 am
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).