Seb Lee-Delisle

Menu

FlarToolkit made easy : SimplAR

As cool as bell-bottom pants according to Keith Peters! Which is pretty damn cool. And it can be really fiddly setting up the FLARToolkit, so I’ve finally released some of my AR code. Just in time for it to go out of fashion. 🙂

It uses the Alchemy branch of the FLARToolkit and includes everything you need to get up and running. It also has a very optimised automatic threshold adjustment system that takes virtually no extra processor time.

Here’s a quick intro :

It’s easy to use, there’s just one class. And I’ve also included swc files for the FLARToolkit Alchemy branch and the latest revision of Papervision2.1. You just need to extend the class and override the add3DObjects function.

package ly.seb.simplarexamples
{
	import ly.seb.simplar.SimplarBase;
	import org.papervision3d.objects.primitives.Sphere;
 
	[SWF (width="640", height="480", backgroundColor="0x000000",frameRate="30")]	
 
	public class AR_Sphere extends SimplarBase
	{
 
		override public function initialise() : void
		{
 
			var sphere : Sphere = new Sphere(null, 40); 
			sphere.rotationX =  90; 
			sphere.z = -50; 
 
			//add it into the container that is updated 
			//relative to the pattern marker
			container.addChild(sphere); 
 
		}
 
	}
}

Check out the screencast below to see how to use a custom marker, handle when the pattern is lost and found, and load a 3D model in.

You can check out the project from my googlecode repository at : http://code.google.com/p/sebleedelisle/

There area couple of extra things I’d like to add to the code, at the moment the size is fixed at 640×480 and the image is not mirrored; both things I would like to fix in the future.

I’d like to thank thesven.com for his FLARToolkit Alchemy code that saved me masses of time! Thanks also to Jesse Freeman and Kyle Kellogg for helping me test this.

This entry was posted in Actionscript, Flash, Flash 3D, Obsolete and tagged , , . Bookmark the permalink.

38 Responses to FlarToolkit made easy : SimplAR