0
votes

I have a very unique Box2D need:

I will have the world set up where polygons have specific colors. Whenever two polygons of the same color overlap, their intersection zone should no longer be solid (other objects can pass through it).

I have no idea how to go about implementing this collision scheme in Box2D. I'm competent in Box2D, so I know all the basics and have used it before. It's just this feature that has me confused.

My current plan: Implement a special contact listener which checks a collision point for overlapping polygons of the same color. I'd like to here other ideas, as this one sounds flimsy and costly, due to how contacts work.

1

1 Answers

0
votes

You could keep a list of current polygons its currently overlapping and if the colliding object is colliding with just one object its solid. If its colliding with more than one, its allowed. When they are no longer colliding (overlapping), you remove the reference from the list.