iniBox2D - use Box2D library in QC plugin

LukeNeo's picture

Hi, this is my first attempt to compile a 2dBox plugin (2dbox.org) for QC. This plugin allow you to specify a 2D chain-constrain through a polyline and to generate boxes that interact with this polyline. You can see in this video how it works:

Plugin inputs: * createBoxes - generates other boxes. * addConstrainVertex - adds a vertex to the polyline (IMPORTANT: you have to define vertices from left to right) * finalizeConstrain - close the polyline: now it can interact with the boxes in the scene

Download(plugin and example composition)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cybero's picture
Re: iniBox2D - use Box2D library in QC plugin

In Lion 10.7.2 - opens only in 32 bit mode.

benoitlahoz's picture
Re: iniBox2D - use Box2D library in QC plugin

Hi,

Thanks for sharing. I guess we are few people to look for physics simulation in Quartz.

Actually I'm working too on a Box2D plugin :

edit : I tried your plugin (10.7.1) and have these issues

-> 30/09/11 01:38:38,082 [0x0-0x4c04c].com.apple.QuartzComposer.editor: Assertion failed: (s_initialized == true), function Destroy, file /Volumes/Luca_01/custom_patches/cw_box2D_kineme/cw_box2D/Box2D/Dynamics/Contacts/b2Contact.cpp, line 103.

-> 30/09/11 01:38:41,045 com.apple.launchd.peruser.501: ([0x0-0x4c04c].com.apple.QuartzComposer.editor[932]) Job appears to have crashed: Abort trap: 6

What version of Box2D are you using ? I had troubles with contacts in 2.1 which disappeared with 2.2. I would be glad to share a static lib compiled for 10.6+ if you need it.

mynameisavisual's picture
Re: iniBox2D - use Box2D library in QC plugin

It crashes when I click to add a polyline.

gtoledo3's picture
Re: iniBox2D - use Box2D library in QC plugin

It works ok for me in SL, but it's a little fidgety/ the boxes bounce well before they hit occluders. Maybe there's something a little off there (totally not complaining!).

Re: the comment about a lot of people doing box2D/physics stuff...

K3D plus particle tools does (err, did) all of this, but in all 3 axises. Maybe users could request a fix for the particle tools k3D renderer again (I've fixed this and submitted the fix, fwiw, but particle tools will still have issues b/c of it being a 32 bit affair, so I see why this feature hasn't necessarily been released).

If one wants to search, there's an old GL Tools project around here that shows how to construct a grid structure, and there's a clever sample qtz that shows how to feedback the info into the patch so that one can grab verts and pull the grid all around. It's not a big leap from there to start adding in other inputs to make the structure "do stuff". When one takes that approach, at the end of the day, you have structures that you can plug into all kinds of QC objects, or iterate the results, and you can input QC structs or single values into your generator to make occlusion, or whatever.

I'm describing this route, because one could really make tools that integrate into QC that do this, and work with a lot of QC patches, instead of being black box... and it also isn't as hard to get stuff working in x/y/z when it's not limited to a 2D framework, and it's even a bit easier... all of that's "eye of the beholder" stuff, it's just what kept me away from that particular route (box2D or bullet stuff).

LukeNeo's picture
Re: iniBox2D - use Box2D library in QC plugin

benoitlahoz wrote:
Hi, Thanks for sharing. I guess we are few people to look for physics simulation in Quartz. Actually I'm working too on a Box2D plugin.

Hi benoitlahoz, your project seems to be a great work! I'll wait for it! :)

benoitlahoz wrote:
I tried your plugin (10.7.1) and have these issues ... What version of Box2D are you using ? I had troubles with contacts in 2.1 which disappeared with 2.2. I would be glad to share a static lib compiled for 10.6+ if you need it.

I'm using Box2D 2.2.1. I can use my compiled plugin on 10.6 and 10.7 if I open QC in 32 bit mode. If you can share static compiled library for 10.6+ it would be great! You can reach me at inimartdesign [ at ] gmail.com Thank you!

LukeNeo's picture
Re: iniBox2D - use Box2D library in QC plugin

mynameisavisual wrote:
It crashes when I click to add a polyline.

Maybe there are some problems with Box2D linked library.. I tried this plugin on 10.6 and 10.7.1 opening QC in 32 bit mode, and it works. What kind of error do you get if you open the system Console?

benoitlahoz's picture
Re: iniBox2D - use Box2D library in QC plugin

It might be a known bug of 2.2.1 version of box2d with non convex polygons. 2.2.2 version now accepts non convex polygons even if it can't great collision detection on them.

[edit : LukeNeo, the library is in your mailbox]

mynameisavisual's picture
Re: iniBox2D - use Box2D library in QC plugin

In 64 bit it doesn't work. In 32 bit it opens without missing patches. But when I click in the viewer for the second time QC crasches and the following message appears :

PreviewAttachmentSize
melding.rtf58.65 KB

LukeNeo's picture
iniBox2D 1.1

This plugin won't work in 64 bit mode. Here it is a quick update, this time I used precompiled library suggested by benoitlahoz. Maybe it will fix some crashes!

PreviewAttachmentSize
iniBox2D_1.1.zip779.38 KB

benoitlahoz's picture
Re: iniBox2D 1.1

Why doesn't it work in 64 bits ? The library I compiled and I sent was 64 bits compatible.

mynameisavisual's picture
Re: iniBox2D 1.1

Still got the crash when I add a second point in the image. :s

Grts