This project has moved. For the latest updates, please go here.

How to suscribe to a collision for a specefic group

Topics: Developer Forum
Jul 3, 2011 at 11:55 AM

I want to have diferent reactions for diferent body collisions. For that, I've grouped them in four groups, but I don't know how to suscribe for each one of the possible combinations of collisions betwen groups.


How can I do it?

Jul 12, 2011 at 7:25 PM
Edited Jul 12, 2011 at 7:26 PM

None can help?

I tried with 


public bool OnCollision(Fixture fix1, Fixture fix2, Contact contact)
            if (fix1.UserData as string == "cube" && fix2.UserData as string == "grass")
                contacts = true;
            return true;


but it does not work.

Jul 12, 2011 at 10:50 PM

Can you provide a complete sample? It's hard to see what might be going wrong because your above code should work provided some other conditions are met.

Jul 13, 2011 at 1:15 PM
Edited Jul 14, 2011 at 4:12 PM

Problem found.

Jul 14, 2011 at 3:39 PM
Edited Jul 14, 2011 at 4:12 PM

Problem found.