1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

Webcam Face detection demo: Now with source!

So a little while ago, Halloween in fact, I threw together a demo of some face-detection stuff I’d been looking at. [Check out the original post here.]  We originally had the demo on the MMT Digital homepage, but recently that’s been updated and my demo got lost in the process, so I’ve restored it here, along with the Flex project for it.

Augmented Reality Halloween

Continue reading Webcam Face detection demo: Now with source!…

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

Link: Computer mind control with ActionScript 3.0

This is a very cool experiment – using a socket in AS3 to interface with Brain Computer Interface (BCI) hardware. Check it out at this url: http://seantheflexguy.com/blog/2009/12/30/neurosky-mindset-brain-computer-interface-actionscript-3-0-api/

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

Demo & Source: Simple Box2D, with curved edges!

 

(The image above this text is actually the Flash movie, if you hadn’t guessed.  Try using your mouse to interact.  If it’s blank, then something’s gone wrong!)

I’ve been busy working on my Box2D classes again. (As before here and here.)  I’m not quite ready to go through the code with some tutorials yet, but you can download the source for this demo here.  This version has had a bit more of a proper code cleanup – I’ve un-hacked some hacks I did earlier in development, and added a few more utility functions, but most importantly this version supports SWF library asset importing of multiple shapes, and shapes with curved edges (which it couldn’t do previously).

I feel like I should put that in bold or something, because it’s probably my most-clever bit of code to date.  I’m going to settle for saying it twice though: You can import library objects with multiple shapes, and shapes with curved and straight edges.  Have a look at the screenshot below and compare it with the Box2D display;

In Flash IDE:

In Box2D:

You can download the source for this demo here.

I’m going to get this as a project on some publicly-available source repository soon.  I’d love to hear feedback on it now though!

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

Link: Flex AutoComplete component

If you’re ever looking for an autocompletion component in the Flex framework, I’d strongly suggest you check this one out: http://hillelcoren.com/flex-autocomplete/ Quite simply it’s awesome, it’s fully featured and packs a helluva lot of options into such a small package.

I swapped an old ComoBox component for it just now, and it worked fantastically with no additional configuration.

Check out the demo for it here: http://web.me.com/hillelcoren/Site/Demo.html

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

Simple Box2D – Custom Polygon creation.

I’ve been working on some classes to simplify Box2D for Actionscript developers (See previous post for a quick intro).  The latest update to these classes introduces couple of minor ideas, and one gosh-darned awesome idea, if I do say so myself.  Let’s start with the awesome things, and move on from there…

Awesome thing: Creating Custom Polygons

Or rather the methods for creating them.  Shapes in Box2D come in three basic flavours – circle, rectangle and custom polygon.  Moreover, everything must be convex (no inny bits), have no more than 8 sides, and can’t have holes.  On the plus side you can still make larger, more complex objects out of smaller ones – but it all involves a lot of thinking.

So, here’s the solution – or rather, the options.

Polygon creation option #1 – Creating a polygon from an array of points.

Using some clever triangulation code from Splashdust.net, there’s a simple method for creating any custom shape from an array of Point objects.  With this method you can create a shape with any number of sides, and not worry about whether the shape is concave or convex.  It’ll still break if the edges of your shape interest each other, and doesn’t support holes in the objects you’re creating, but it’s a start.

var array:Array = [ new Point( 0, 0 ), new Point( 10, 0 ), new Point( 10, 10 ), new Point( 20, 10 ), new Point( 20, 0 ), new Point( 30, 0 ), new Point( 30, 30 ), new Point( 0, 30 ) ];

world.createComplexPolygon( 50, 50, array );

Polygon creation option #2 – Creating a polygon from a shape in a library.

This is where things get cool.  Creating a shape from a series of points is all well and good, but it’s a laborious process to set up and modify.  You can create a shape in the Flash IDE, add your symbol to your library and import it to Box2D.  Currently this method only supports single shapes on a single layer, and only straight edges – but multiple shapes, layers and curved edges are definitely on the list for the future.

world.createPolyFromLibraryShape( 300, 100, "sampleShape", "vectorassets.swf" );

Continue reading Simple Box2D – Custom Polygon creation….

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

Simplifying Box2DAS3…

One of the downsides to the Box2DAS3 project – and probably one of the major hurdles to most Flash developers – is the fact that it’s inherited a lot of the syntax from the C++ project that it’s derived from.  Maybe it’s just because we’re used to it, but Actionscript is pretty easy to understand, and its methods of working pretty tolerant of inefficient coding.

C++ – or whatever Box2D is written in – is not, and it’s a little painful to setup and easy to break.  For my sanity as much as anyone else’s I’m working on a set of classes in AS3 that wrap around the Box2DAS3 classes, and provide you with a more familiar syntax for working with Box2D – objects, methods and utilities that makes it quicker to throw things together and don’t require you to rethink the way you work.

Well, that’s the eventual aim anyway.

Here’s the result of the first round of development – creating a Box2D world and adding objects, in about 6 lines of code.

var options:Box2DWorldOptions = new Box2DWorldOptions( 500, 280, 30, 9.8 );
options.setWorldEdges( true, true, true, true );
var world:Box2DWorld = Box2DUtils.createBoxedWorld( options );
world.debugDraw = true;
world.animateOnEnterFrame = true;
addChild( world );
for ( var i:int = 0; i < 30; i++ )
{
world.createCircle( 500 * Math.random(), 280 * Math.random(), 50 * Math.random());
}

And here’s the result:

Continue reading Simplifying Box2DAS3……

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

The results of my annual “code something different this Christmas” idea.

It’s becoming something of a tradition now I guess, but once I’ve allocated that extra Christmas holiday time appropriately, I find I have that little bit of extra time to devote to trying something new.  This year, I thought I’d try rewriting (again) one of my old university experiments.

Here’s the result:

It’s pretty.  I won’t even try to explain the idea behind it, but it’s basically an attempt at simple life simulation, with some AI governing the actions.  This time around I’ve built it with the aid of Box2D, so all the movement, impacts and interaction is achieved by punching some figures into the Box2D world, which makes the thing a helluva lot easier.

The big plus of “trying something new”? I now have a basic understanding of trigonometry!  I didn’t even have to Google anything!