Flint Particle System Forum - Physically based Particles 2011-06-23T13:22:51+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Physically based Particles http://flintparticles.org/forum/comments.php?DiscussionID=167&Focus=671#Comment_671 2009-02-09T20:46:01+00:00 2011-06-23T13:22:51+01:00 BorisTheBrave http://flintparticles.org/forum/account.php?u=156 I think you're gonna like this.. I've released a library that ties the Box2D Flash physics engine in with Flint. With a few lines of code, you can have Box2D's full power while still using all the ... I've released a library that ties the Box2D Flash physics engine in with Flint. With a few lines of code, you can have Box2D's full power while still using all the Flint primitives you are used to.

More details are here, with a demo available.

If you click twice on the demo, you'll find the "Flint only" example, aimed at Flint users. I append the bulk of the source for that to give you an idea how simple it is to get started.

BodyRenderer.defaultScale = 10;

//Create a Flint emitter and initialize it with some standard particles stuff
emitter = new Emitter2D();
emitter.counter = new Steady( 15 );
emitter.addInitializer(new Position(new DiscZone(new Point(0,0),30,30)));
emitter.addActivity(new FollowMouse(this));
emitter.addAction(new MutualGravity(3, 100));
emitter.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 10, 10)));
emitter.addInitializer(new ImageClass(Dot, 10));
emitter.addInitializer(new Lifetime(2, 20));
emitter.addAction(new Fade());
emitter.addAction(new Age());

//Use a physics activity, and keep a reference to it.
var physics:Physics = new Physics();
emitter.addActivity(physics);
//Lets give the position solver a bit more pep, as we are creating lots of overlapping shapes
physics.positionIterations = 30;

emitter.addInitializer(new CollisionRadiusInit(10));
emitter.addInitializer(new CircleInit(physics.world));

renderer = new DisplayObjectRenderer();
addChild(renderer as DisplayObjectRenderer);
renderer.addEmitter(emitter);

emitter.start();


I'm afraid for more complicated effects, you'll actually need to learn something about Box2D, but nonetheless, I think it's a fairly easy system to use.]]>
Physically based Particles http://flintparticles.org/forum/comments.php?DiscussionID=167&Focus=673#Comment_673 2009-02-11T07:56:05+00:00 2011-06-23T13:22:51+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Fabulous.