As part of releasing GLib, the 2D geometry library I'm working on (http://board.flashkit.com/board/show....php?t=782032), I'll be releasing 2 libraries that use GLib.

The first library will be SLRBS (Super Lightweight Rigid Body Simulator lol). I know, I know, the last thing anyone needs in the Flash world is another physics engine, but it has its charms. When I wrote my first engine, FOAM (http://blog.generalrelativity.org/?cat=12), the overwhelming response was from people who wanted to know how to "make my movieclips physics" (i swear to god that's a direct quote). I also noticed that a huge percentage of a physics engine is purely geometrical... So GLib offers means to turn DisplayObjects into a geometrical model.

SLRBS uses GLib to create the geometry for rigid bodies. So what it boils down to is creating a rigid body physics simulation with one line of code. Of course the user will have a lot of control over physical properties etc, but there's a generic simulation startup that should be stupidly easy to use. I even downloaded a trial version of Flash to try it out (where the hell did this wonky panel setup come from? ick).

Here are 2 demos, sorry no interactivity until i clean up the physics quite a bit:

The first is a car rolling off a ramp and through tires and footballs.

http://lab.generalrelativity.org/gli...toGen/car.html


The image shows the Flash file, just a bunch of MovieClips arranged on stage. Here's the only code in the FLA:
Code:
import org.generalrelativity.slrbs.SLRBSimulator;

var simulator:SLRBSimulator = SLRBSimulator.createSLRBSimulatorFromContainer( this );

addEventListener( Event.ENTER_FRAME, onEnterFrame );

function onEnterFrame( event:Event ) : void
{
	simulator.step( 1 / 60 );
}
And that's it! You pass in the DisplayObjectContainer to build the simulation from and it handles all the creation for you. It uses some defaulting arguments. Most notably is how it builds the car. There are intersection types for how the simulation setup deals with MovieClips that intersect. The default, and what's used here is to pin the top MovieClip to the bottom at its determined center of mass. So each of the wheels get pinned by their centers to the car.

Next is a ragdoll, hanging on and getting beaned by tires and footballs too:

http://lab.generalrelativity.org/gli...n/ragdoll.html


Again, you can see the MovieClip setup as it exists on the Stage in the IDE. The only difference in the code between the 2 is the ragdoll passes an overlap type that builds pin joints at the center of the intersection, which works well for building a quick ragdoll.
Code:
var simulator:SLRBSimulator = SLRBSimulator.createSLRBSimulatorFromContainer( this, SLRBSimulator.ACO_PIN_AT_OVERLAP_MEDIAN );
There are 2 other overlap types, complex, which just builds rigid bodies with a combination of intersecting shapes and ignore which will let them start the simulation there.

I still have a lot of work before I'll be happy releasing it, but it was a ton of fun to drag a bunch of MovieClips onto stage and watch them come to life with barely any code. But I totally think the most interesting aspect is that it uses the geometry library well enough that the whole of SLRBS is probably only 200 lines of code if you strip out all the OOP.