_1024_BOX2d

franz's picture

Just released Box2D plugin, that I'll use for an upcoming show. Feature set is quite minimal at the moment, but I expect to expand it over the next few month.

Get it from www.1024d.wordpress.com

Comment viewing options

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

gtoledo3's picture
Re: _1024_BOX2d

Thanks for releasing this. When I saw it on your blog yesterday I was licking my lips, and started looking at a way to put it together myself. I've been wanting some kind of box2d stuff in qc for years. My fav is the fretehand draw physocs stuff.

cybero's picture
Re: _1024_BOX2d

On 10.6.6 I found that whilst honoured and listed in the Patch Library in 32 bit mode QC, once I had generated a crash with the plugin in 64 bit mode QC, it simply disappeared from the Patch Library window in 64 bit mode QC, whilst still available in 32 bit mode QC.

Thanks for sharing , really nice.

BTW, the crash probably is directly related to the use of an Iterator, which doesn't cause such a fuss in 32 bit mode.

It does some wicked stuff when iterated :-). Scale to 0.1 in a 3d Transform reveals much too. Can be successfully audio visualized.

One final look before shutdown and even your demo composition doesn't open up in QC 64 bit.

Perhaps clearing the QC cache will make a difference.

photonal's picture
Re: _1024_BOX2d

great stuff - I was hoping for ages that someone might integrate something like the Bullet physics engine into a QC plugin!

this is so brilliant! looking forward to when the 'image input' is enabled ;-)

Mask support with Images would be nice too. Would the Box2d lib support that? i.e. collisions would take into account the mask.

franz's picture
Re: _1024_BOX2d

the plugin is NOT 64bit friendly. There's some 64bit related issues in my B0x2d lib. Currently 32 bit only.

Also, placing the Box2D in an iterator is not recommended.

cybero's picture
Re: _1024_BOX2d

Thanks for the feedback, franz.

Great work BTW :-).

I know you don't recommend placing the Box2d within an iterator, but it does seem to do some spectacular things when placed into such a process patch.

Using a higher iteration rate than 3 does really give a pretty gross performance hit.

Besides, upon further examination of what can and can't be 'safely' achieved with the box2d plugin, I'm now wondering , apart from affecting , by way of accelerating the rate of box propagation, what else can be usefully achieved by placing that plugin patch into an iterator.

I really like the way it just keeps on popping up boxes.

Works nicely in a GL Polygon Mode patch too.

franz's picture
Re: _1024_BOX2d

it will create one box per frame, so at 60FPS, you'll have 60boxes per seconds. I'll modify it and publish a RATE input, so you can have more. (and publish friction and bounce param. as well)

gtoledo3's picture
Re: _1024_BOX2d

The only thing I'm having happen that I consider "weird" is that all of the boxes bounce every few seconds.

franz's picture
Re: _1024_BOX2d

due to the bouncing value I hardcoded. Will also publish this parameter for tweaking. The problem with these parameters is that they are object-level, not global, so it will happen at the creation of an object, you can't change them live. Once the object is created, you're done.

(waiting for a few remarks/features, then eventually implement them, if they're not too much of a hassle. But so far I'm ok with it right now, it will be perfect for my performance ---boxes controlled by sound---)

cybero's picture
Re: _1024_BOX2d

Weirdly enough - plugin appeared in 64 bit QC, was working in that QC, then crashed and no longer appeared. Perhaps I ought to try de-installing the patch and see if I can reproduce that, but I'm having too much fun with it in 32 bit QC to try that to be honest :-).

Also placing the box2d render patch inside any macro seems to affect the way it's working.

Funnily enough I've found that my Iterator based Box2d comps seem rather more stable than when simply wrapped in a plain macro and that's using pretty much the same core construct. See IteratedBox2D_1.qtz attached below, doesn't use AC Signal. Also needs an audio file for audio throughput. Have attached the audio file used for completeness.

Must see if the patch works nicely with Kineme Audio Tools.

Furthermore, constructs outside of a macro , at stage level 0 as it were are crashy , yet will render when wrapped in a plain macro.

See attached 008 - at level 0, 008a , within a macro. 008 crashes for me, whilst 008a renders . BTW both of these use AC Signal, shall swap out for the private patch Signal and see if that helps out with 008.

Definitely a lot of fun to work with, but seems a trifle delicate, especially if signalling true / false to the switching inputs . [see comment above though about switching Booleans]

PreviewAttachmentSize
008.qtz5.25 KB
008a.qtz5.48 KB
IteratedBox2D_1.qtz19.43 KB
MATP.Funk_.mp3_.zip2.14 MB

cybero's picture
Re: _1024_BOX2d

Would blending support be possible?

cybero's picture
Re: _1024_BOX2d

After further experimentation, I'm finding that almost all the Boolean inputs are actually pretty stable on switching on and off, except for the Move switch input.

& after further experimentation, I'm finding that it's the way and the periodicity with which one feeds the values to the Boolean seems crucial.

cybero's picture
Re: _1024_BOX2d - with audio included

photonal's picture
Re: _1024_BOX2d

I'm not trying to build an Angry Birds comp but would it be possible to have the controls as none globals? I tried to place a second set of boxes to act as obstacles (without movement/gravity etc) but it seems these values are being read anyway from the other box instance. See attached.

Or am I doing something wrong here?

PreviewAttachmentSize
_1024_BOX2D-Obstacles.qtz39.78 KB

jersmi's picture
Re: _1024_BOX2d

Very very good! super addition to the already impressive collection of 1024 plug-ins. hope you develop this. the 2DBox engine is nice!

feature requests: polygons, image input (of course) and joints

can't explain the non-linear thought process, but nam june paik and the iggy pop song tv eye come to mind. guess this makes me want to fill the screen with tv eyes or something....

1024 rocks.

cybero's picture
Re: _1024_BOX2d

So far as I can make out your comp's 2nd Box2d patch isn't even having elements attached as the Boolean value is not being entered. Consequently no 2nd set of boxes results. There does seem to be a 'sharing' of information after a fashion between the two patches when both are required to Add Elements, like Gravity and Mouse position.

franz's picture
Re: _1024_BOX2d 1.1

1.1 release, download from the same place.

Now has a "Add Static Box" option, and a few other tweakable parameters, like friction, bouncing, simulation quality, blending....

Note: this patch is not intended to have 2 instances within the same QTZ.

franz's picture
Re: _1024_BOX2d

check the new version for obstacles

cybero's picture
Re: _1024_BOX2d 1.1

Thanks for the clarification and many thanks for the update.

[From here on, no more than one Box2D patch per single QC comp :-)].

rick's picture
Re: _1024_BOX2d 1.1

Hello All, Please help, after installing (as usual) to / library / graphics / quartz composer plugins

I still get this (below).

thanks.

(null) : Patch with name "QCPlugInPatch:_1024_BOX2DPlugIn" is missing

BOX2D Cannot create node of class "QCPlugInPatch" and identifier "_1024_BOX2DPlugIn"

BOX2D Cannot create connection from ["outputResult" @ "Expression_1"] to ["inputMove" @ "PlugInPatch__1024_BOX2DPlugIn_1"]

BOX2D Cannot create connection from ["outputSignal" @ "Pulse_1"] to ["inputAddStatic" @ "PlugInPatch__1024_BOX2DPlugIn_1"]

BOX2D Cannot create connection from ["key_0063" @ "Keyboard_1"] to ["inputClear" @ "PlugInPatch__1024_BOX2DPlugIn_1"]

BOX2D Cannot create connection from ["outputY" @ "Mouse_1"] to ["inputY" @ "PlugInPatch__1024_BOX2DPlugIn_1"]

BOX2D Cannot create connection from ["outputResult" @ "Expression_3"] to ["inputAdd" @ "PlugInPatch__1024_BOX2DPlugIn_1"]

BOX2D Cannot create connection from ["output" @ "Multiplexer_1"] to ["inputGravY" @ "PlugInPatch__1024_BOX2DPlugIn_1"]

BOX2D Cannot create connection from ["outputX" @ "Mouse_1"] to ["inputX" @ "PlugInPatch__1024_BOX2DPlugIn_1"]

BOX2D Cannot create connection from ["output" @ "Multiplexer_4"] to ["inputColor" @ "PlugInPatch__1024_BOX2DPlugIn_1"]

Macro Patch State restoration failed on node "Patch_1"

(null) State restoration failed on

PreviewAttachmentSize
plugins.png
plugins.png84.96 KB

cybero's picture
Re: _1024_BOX2d 1.1

What you need to do is Spotlight on Quartz Composer, Select Quartz Composer application icon, Command + C to copy the application, Command + V to replicate the application,Command + i to get info on the duplicated application, set to 32 bit in the Info panel and rename to QC 32 bit or something similar, open Box2d applications only in this duplicated, 32 bit version of Quartz Composer and you'll never see those worrying messages again :-)

_1024 Box2d is not fully 64 bit compliant. I haven't found version 1.1 cropping up once in QC 64 bit like version 1.0 did once [and once only, then crashed, then I got those messages you have reported above]

cybero's picture
Re: _1024_BOX2d

Version 1.1 plays nicely with some of the older children like Matrix Mult and Polygon Mode. Within an RII, additional elements need additional nudging rather than a one off switch to true. Curiously enough, any of the Boolean inputs will do some kind of nudging.

PreviewAttachmentSize
Box2DMultMatrix.jpg
Box2DMultMatrix.jpg90.14 KB
Box2DMultMatrix.qtz22.59 KB

benoitlahoz's picture
Re: _1024_BOX2d

Thanks so much for this new one ! I love your plugins. Don't know if it would be possible but, apart of dreaming of an enabled image input, I would like to be able to drag few of the boxes with the "Move" input, like I did with a "brush" on your Bezier Plugin (see http://kineme.net/forum/Discussion/Programming/1024GLBezierSurface#comme...).

So I can make the shadow move precise boxes VS using gravity like in the vids posted below... :-)

Thanks again for sharing your (hard) work ! Hope you're happy with this "Euphorie" I had the pleasure to see in Le Cube.

gtoledo3's picture
Re: _1024_BOX2d 1.1

Maybe not/maybe so. I do see the pic that shows only one box2d plugin, so you may be right on, but this probably bares mentioning:

I upgraded, and was getting restoration problems (in 32bit) until I realized that the old plugin didn't get appended w/ "old" (talking about kinemecore functionality now).

There are two plugins now; one with a .1 appended. So, when you "upgrade" with something like k-core, the old one doesn't get pushed out. When QC loads, it will most likely load the first one instead of the second, because of the dates (I believe).

So, one needs to manually remove the old box2d plugin. I can't remember exactly what you can/can't change to make sure the old one's get pushed out w/ k-core. I think the fact that the plugin has a dif name, even though the class is the same, may have been the impasse.

gtoledo3's picture
Re: _1024_BOX2d 1.1

As you've looked at this, do you think it would be possible to output a useable structure instead of directly rendering?

(I know you never publish source, but I would really like to implement the box2D free draw stuff. If you ever see fit to publish or share the proj, I would certainly try to get that going and pass it back to you as time permits.)

photonal's picture
Re: _1024_BOX2d

Sorry, I should have said also : I did a rapid click on the boolean to produce the obstacle boxes.

benoitlahoz's picture
Re: _1024_BOX2d

Oups... I forgot posting the comp'

Draft version... :-) I deleted the shadow videos in there, but you can track any color for creating boxes (one box each time the color X changes with a "Signal" patch).

PreviewAttachmentSize
BEN_BOX2D_OMBRE_3.qtz80.48 KB

cybero's picture
Re: _1024_BOX2d 1.1

Well spotted about the retention of the prior version and partial lack of Kineme Core functionality.

However, those messages reported by Rick, I only get when I open a _1024 comp in QC 64 bit. BTW, I've updated the Box2D MultMatrix , just to ensure it has the version 1.1 functionality.

I did get a slightly different but similar failure to fully fly message right after the upgrade and yes, removing the old plugin removed that partial failure in QC 32 bit , but it didn't actually stop the rendering from happening, despite being preceded by that message.

photonal's picture
Re: _1024_BOX2d 1.1

1.1 is awesome!

photonal's picture
Re: _1024_BOX2d

I'm not sure of the technical word for it, but this comp blows up on me - it goes red.

Any ideas how to avoid that + get it working?

dust's picture
Re: _1024_BOX2d

woot, woot. great idea. taking a class in programming physics right now. very interesting stuff. just made it to free falls, trajectories, and drag or friction problems right now. would be sweet if i could just use this plugin for the free fall problem but i have to show how i am compensating for non uniform gravity and things like that although i am able to use qc. i'm thinking this class will help me improve my angry birds score.

rick's picture
Re: _1024_BOX2d 1.1

That worked and thanks!

Thank You All, for the hard work and inspiration.

benoitlahoz's picture
Re: _1024_BOX2d

Did you install the 1.1 plugin WITH deleting the 1.0 one ? It seems that it matters...

photonal's picture
Re: _1024_BOX2d

Thanks, I ended up just reimporting the Box2D plugin into the comp which sorted things out.

photonal's picture
Re: _1024_BOX2d

Inspired by :

is a 'Cruiseship on Stormy Seas simulator!'

As usual, click 'S' to place the tables/fixed furniture and 'D' for passengers... ;-)

mattl's picture
Re: _1024_BOX2d

This is awesome.. Has anyone had any luck linking an image with alpha/transparency?

franz's picture
Re: _1024_BOX2d

doesn't work yet. It's in the tube....

benoitlahoz's picture
Re: _1024_BOX2d

:-))) Yes, I'm working on Haruki Murakami right now and his novel about the Kobe Earthquake !

photonal's picture
Re: _1024_BOX2d

Just wondering if there's any chance that the following could be implemented in your great Box2D plugin?

i) 2 Image support; one image for the fixed box and another for the bouncing boxes.

ii) Could the alpha channel of images be taken into consideration for collisions? i.e. boxes would not collide on the transparent part of images

franz's picture
Re: _1024_BOX2d

i- it's in the works. image structure input. problematic at the moment however.

ii- no, that's impossible, due to how box2d work internally.

mattl's picture
Re: _1024_BOX2d

and could it support circles?

gtoledo3's picture
Re: _1024_BOX2d

One of the coolest box physics examples lets you draw shapes freehand, which you can then interact with, toss around etc. If you draw a long curve, it has a kind of springiness, for example.

initi's picture
Re: _1024_BOX2d

how can i do this, pls? http://vimeo.com/35798395 how can i use more types of words in one composition? thx for help. d.

franz's picture
Re: _1024_BOX2d

with the published plugin you can't. Adrien is using a heavily modded, super-hackish version of _1024_BOX2D ...