Hi,
i'm a beginner in box2d.
I've created 3 fixtures with same index.
fixtureDef1.filter.groupIndex = 0x2;
fixtureDef2.filter.groupIndex = 0x2;
fixtureDef3.filter.groupIndex = 0x2;
But i want to filter collisions in individual group in some conditions for some objects.Also those objects must collide with other groups.
All suggestions are welcome !!
Vibha
what version are you using? 2.0 or 2.1?
i'm using box2d 2.1.Now the issue solved using mask bits.Thanks for your reply!!
I want to change the collision filter of an existing body.is it possible in box2d 2.1?
mask bits and filters are the best way to achieve "a hits b, b hits c, c does not hit a"
but if you are wanting something a bit more dynamic and based on qualifying conditions. you may want to look into the PRE_SOLVE contact event.
you can disable any contact based on if its meets your criteria. (probably a bit heavier processor wise than filtering, but easier to implement in my opinion)
this is commonly used to achieve a one-way platform, but has many potential uses.
also your question about updating collision filter of existing bodies:
w/o looking into it specifically i have a few recommendations.
-if you are changing a value but getting an error, make sure you are changing it outside of the time step (on next ENTER_FRAME)
-if you don't see a value to change, you could potentially recreate your shape with the new setting, which would ideally happen seamlessly, (with some cpu cost)
Actually i wasn't aware of PRE_SOLVE contact event.I think it is very useful concept.
I'm very beginner in box2D.So i don't know how to change the fixture filer def.I was able to take filter data.
Can you tell me how to update the fixture filter def?