android - how to avoid collision between different groups in box2d -


i have studied lot collision filtering using categories , masks , groups. involve prevention of collision between related object while collide opposite group. case totally different have 2 groups , want should collide within group bodies of different group can't collide bodies of opposite group.

for example blue balls can collide each other , red ones red ones. no blue ball can collide red ball. thoughts on this

you can set group index negative bodies wont collide , can set group index positive bodies want collide.

collision groups let specify integral group index. can have shapes same group index collide (positive index) or never collide (negative index). group indices used things somehow related, parts of bicycle. in following example, shape1 , shape2 collide, shape3 , shape4 never collide.

shape1def.filter.groupindex = 6; shape2def.filter.groupindex = 6; shape3def.filter.groupindex = -8; shape4def.filter.groupindex = -8; 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -