collision
how to detect collision in box2d component? not just box collision,
if you want to detect collision of a specific body i know you can do something like:
ContactEdge contact = body.getContactList();
while (contact != null) {
contact = contact.next();
}
I also know that there's a ContactListener but haven't found any documentation or way to use it...
thanks! i never thought of using while, i struggle implementing it on for loop but no luck.
if you want to use for it can be done like this:
for(ContactEdge contact = body.getContactList(); contact != null; contact = contact.next()) {
// contact logic here
}
It may be a little bit more complicated to get started with ContactListeners, but they are a lot easier to use in the long run. I will write up a PR with the system I have built for simplifying this so that others can use it too.
There we go. Once #304 is in, it will be a lot simpler to do this. You can have a look at it already if you want, and comment if you want it to have a different behaviour than how I suggested.
#304 is on 0.20.1