there are two sets of circles in the example (red and blue), all exist within the same box2d environment although their filter settings are set so that only blue collide with blue and only red collide with red.
i also had to create to set two sets of bounds (rectangles that stop the balls going off screen), not ideal but does the job for this example.
you could also figure out what two shapes are colliding and decide if to ignore that collision.
so in your case, check if one of those shapes is your boundary and if it is then ignore the collision.
i do this using a little method i put inside ofxBox2dBaseShape class,
Thanks for the post.
This is really good stuff to know.
Now I am wondering about intersection points.
Well here is what i am trying to do.
as you can see in the image on top of this thread i have an outer shape and want to fill it with rectangles.
but i have to make sure these rectangles don’t intersect each other. if some do i will reduce the number of rectangles.
all i need as a final result is the positions of all the rectangles. i don’t need an animation just a static image + values at the end.
so will the contact listener and filter helps , it does not help to find such perfect distribution.
For anyone interested in this, I have a custom class extending ofxBox2dCircle which i want to collide with the rest of the Box2d shapes but not between them. I added a collision filter in the set up like this
void setup(b2World * b2dworld, float x, float y, float r, int l) {
ofxBox2dCircle::setup(b2dworld, x, y, r);
life = l;
b2Filter f;
f.categoryBits = 0x0002; // new category
f.maskBits =0x0001; // collide with default mask only
setFilterData(f);
};