This project has moved and is read-only. For the latest updates, please go here.

How to suscribe to a collision for a specefic group

Topics: Developer Forum
Jul 3, 2011 at 12:55 PM

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 8:25 PM
Edited Jul 12, 2011 at 8: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 11: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 2:15 PM
Edited Jul 14, 2011 at 5:12 PM

Problem found.

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

Problem found.