JBox2D and Processing

Just wanted to say hello and post a quick note announcing a release of a set of examples (along with a teeny tiny helper class) for using JBox2D in Processing.

Source: https://github.com/shiffman/PBox2D

Download: http://www.shiffman.net/p5/libraries/pbox2d/pbox2d.zip

If you aren't familiar with Processing:

http://processing.org/

Comments, questions, suggestions, feedback, etc would be most welcome!
Looks awesome, great job! You might want to refrain from using the reflection in the contact listener, as I'm guessing that will slow down the runtime a lot. Is it possible to make an inner class that implements ContactListener in processing?
toucansam wrote:
Looks awesome, great job! You might want to refrain from using the reflection in the contact listener, as I'm guessing that will slow down the runtime a lot. Is it possible to make an inner class that implements ContactListener in processing?


Yes, indeed. I have an example that demonstrates how to "implement" a ContactListener, but interfaces are not something that many Processing users are familiar with so I used reflection to generate callbacks to match what Processing beginners are used to. The interface example is here:

https://github.com/shiffman/PBox2D/tree ... lInterface

I'm writing a chapter in an upcoming book about Box2D and Processing so I'll be sure to mention the performance question.

Also, I just noticed my ConstantVolumeJoint doesn't work properly (collapses on itself). I built my own JAR from the current source because the download does not include ChainShape which I wanted to include in my examples. With the downloaded JAR, it does work. Any chance you know offhand if I've done something wrong?

https://github.com/shiffman/PBox2D/blob ... y/Blob.pde

This is a very minor problem that I'm sure I can look into and figure out, don't mean to ask you to debug my code. Just if you know offhand.

Dan
shiffman wrote:
This is a very minor problem that I'm sure I can look into and figure out, don't mean to ask you to debug my code. Just if you know offhand.

Haha well unfortunately it's an issue with the trunk, as I'm not totally done updating the engine to the latest version. Erin did some good changes with separating solver data out from the bodies during computation, but I haven't looked into how that'll translate in the CVJ yet....basically the trunk isn't completely stable. I'd like to say I'm going to work on that soon, but it's prelim season 🙁

I have a google group that I use for announcements about releases or the trunk, if you want to stay informed.

On another note, are there UI libraries for processing? I'd love to help throw in testbed support. Although I'm not sure how practical it would be, as processing provides a lot
toucansam wrote:
Haha well unfortunately it's an issue with the trunk, as I'm not totally done updating the engine to the latest version.


No worries just want to make sure I wasn't doing something wrong! It's a good excuse for me to make an example demonstrating how to create a custom skeleton for "blob" like creature with bodies and joints anyway. I joined the google group, thanks!

toucansam wrote:
On another note, are there UI libraries for processing? I'd love to help throw in testbed support. Although I'm not sure how practical it would be, as processing provides a lot


ControlP5 (http://www.sojamo.de/libraries/controlP5/) would probably be the best bet for this (though the library has some quirks). One thing that would be great is for me to build into my library a "debugdraw" so that users could quickly visualize the box2d world. It would be great to recreate all of the testbed stuff, but packaging it into one giant Processing sketch might be madness (the Processing IDE isn't great for really large software projects with many classes). It could either exist for advanced users as a full-blown Java app (using SWING for GUI and Processing for drawing) or as a set of separate individual examples.

Original thread: https://box2d.org/forum/viewtopic.php?t=8184