I recently tried to update to the current JBox2D version. The version I used before was checked out around march and the readme file says "Current SVN version: 2.0.1+".
After having some issues with multiple worlds which seem to be solved (see related thread), I still struggle with the way contact points between a solid and sensor are reported:
Before updating
-when the solid hits the sensor I got an "add"
-while the two objects were touching probably a few "add"s and "remove"s were produced (but always in a way that in total there were more adds then removes)
-when loosing contact with the sensor a "remove" was called resulting in an equal number of total add and remove calls
So for deciding if I have contact with a sensor I just counted the "add"s and "remove"s and if I counted more adds there was contact.
Currently I seem to get an awful lot of "add"s and no(!) "remove"s.
Any help appreciated.
Hey, sorry for the late reply on this topic, I've been on vacation this week. I think this issue was brought up before in the big thread. An easy workaround is to look at the m_contactList in the body, which shows you all the current contacts of a body.
I took a first look and didn't see anything blatantly wrong. From the optimizations I made it so the contact point is always reused, but I don't think I changed anything else. How important is this specific issue? This will eventually get solved when we update the engine's contact system, which handles stuff differently, but if it's something that's major to your use of jbox2d then I can also take a more in-depth look at it. If so, what types of contacts are these?
Hi toucansam. No worries, I'm sure you deserved your vacation. 🙂
The described problem currently prevents me from updating to the latest JBox2D version. That's not a major problem because the old version works stable, it just would feel good to keep up with JBox2D development and make use of all the optimizations. I don't like the idea of changing the code to checking the object's contactList too much because I find it a little more elegant the current way and believe Erin said something like he does not recommend reading the contactlist for application logic. What are the plans about updating the contact system - is that a change not yet ported to the Java version or will the C++ code base be improved?
If you would like to tackle the problem, I would be happy but (of course) please don't feel obliged. In my application the described behaviour occurs when a solid sphere passes a static rectangle-shaped sensor.
The contact system update isn't a part of the engine yet, the current system is from an older version of the C++ code base.
I looked at the specific contact point, and I still don't see anything blatently wrong. If you want to, you could go through the revisions to see which messed this up, which would tell us what was changed that caused this. But that's a lot of work, you might just want to wait for the update, which I would like to do in the next couple weeks or so, depending on how big of an update this is.
okay, so it's probably best if you concentrate on the contact system update.
When I find any hints on what the problem causes I'll post in this thread.
the updating project will be in the "updating" folder in svn
Four hours of debugging later, I find this thread 😢
If it helps your efforts, the behavior seems to be more consistent with circles, when the circle is on top of any other object.
I'm trying to narrow this down while I look for what's wrong. Does enabling/disabling TOI affect this behavior?
Ok I think I fixed it. There was a problem with storing the previous manifold. Let me know if it worked
(rev 228)
Ah, that fixed it. Thanks!