Get bodies in AABB

yezide
Posts: 5
Joined: Mon Jan 31, 2011 2:45 pm

Get bodies in AABB

Post by yezide »

What would be the easiest (and fastest) way to get the bodies in an AABB?

The size of the AABB will vary and the number of times it is called per frame will too (some frames no checks are needed, other frames many checks are needed).

I am looking at using btGhostObject, but then I would have to resize the shape before every check and I am guessing this can be expensive?

Would be very grateful if anybody could point me in the right direction!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Get bodies in AABB

Post by Erwin Coumans »

You could try using the btDbvtBroadphase, and use the btBroadphaseInterface::aabbTest query and implement your derived class from btBroadphaseAabbCallback:

Code: Select all

	virtual void					aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback);
Thanks,
Erwin
yezide
Posts: 5
Joined: Mon Jan 31, 2011 2:45 pm

Re: Get bodies in AABB

Post by yezide »

Worked great! Thanks a bunch!