Bounding box query

Discuss any Chipmunk bugs here.

Bounding box query

Postby carlessr » Sun Feb 14, 2010 9:05 am

Hi,

I've been using cpSpaceBBQuery, I noticed that when I placed my shapes in a given group, 1 for example I got returned every other group apart from the one I specified. I believe the bug is in the code below, I think !(shape->group) should be exclusive of the (context->group == shape->group)


Code: Select all
static void
bbQueryHelper(cpBB *bb, cpShape *shape, bbQueryContext *context)
{
   if(
      !(shape->group && context->group == shape->group) && (context->layers&shape->layers) &&
      cpBBintersects(*bb, shape->bb)
   ){
      context->func(shape, context->data);
   }
}





becomes


Code: Select all
static void
bbQueryHelper(cpBB *bb, cpShape *shape, bbQueryContext *context)
{
   if(
      !(shape->group) && (context->group == shape->group) && (context->layers&shape->layers) &&
      cpBBintersects(*bb, shape->bb)
   ){
      context->func(shape, context->data);
   }
}



Cheers
Rich
carlessr
 
Posts: 18
Joined: Wed Jan 27, 2010 3:15 pm

Re: Bounding box query

Postby slembcke » Sun Feb 14, 2010 1:29 pm

No, that's the correct behavior. It works exactly the same as collision shapes. You aren't specifying a group to query, you are specifying one to ignore. This is a lot more useful with ray and point queries maybe, but I wanted to be consistent. If you need to do further filtering, you can do so in your own callback.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Bounding box query

Postby carlessr » Sun Feb 14, 2010 3:42 pm

oh ok, sorry about that.
carlessr
 
Posts: 18
Joined: Wed Jan 27, 2010 3:15 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest