For a few projects that I have in mind I've been looking at physics engine which are programming libraries that let you simulate some laws of physics and are usually used in games to give a more realistic feelings to thing. Some games are even only based on the physics simulation, like Perfect Balance.
After ruling out the possibility of writing my own engine - it is VERY complicated when you start to go beyond Newton's law of motion and try to implement collision detection and response - I found Box2D, a free open source engine initially written in C++ but also available for Java (JBox2D).
The library let's you define and position bodies and define how they work with each other using joints.
In this experiment I created a landscape using solid static bodies and moving ones that react to other bodies. I created a bridge by linking bodies with joints and a rotating thingy with a joint that act as a motor.
Unfortunately I'm not able to record the animation so dowload the Processing sketch and try out yourself. You will also need to download JBox2D here and copy it to you Processing libraries folder.
nice! i've been toying with box2d and clutter but haven't gotten anything to work yet.. bloody c++ and i'm too easily distracted..
ReplyDelete-l
A reader from Mexico, that´s cool!
ReplyDeleteHope this can get you started. The Java port tries to conform to Java conventions but the class and methods names are quite similar to the original lib.
Are you planning on using OpenFramework for rendering? If you get something working could you share some code, maybe post it here?
Take care
i was using just clutter and some clutteractors, but it's a bit of a hassle if i just want to build visuals and not whole UIs.
ReplyDeletei found box2d for OF. i might try to do some wierd stuff during the weekend. i'll post the code if it works :)
cuidate
-l
got too lazy to play around with b2dOF, but did something else (slightly related to the 360 theme :)
ReplyDelete=> http://lauri.sokkelo.net/index.php?p=Equalizer%20experimentation
can't wait to get access to some real HW..