Physics in AR

20 Oct

Huzzah! After two evenings of work (the bestest time to code) I got a physics engine working with AR.

Specifically, Jiglib working with FLARManager.

Jiglib is an open source as3 physics engine that has been ported from c++. FLARManager is an extension of FLARToolkit but has lots of extras like the ability to read out x,y and z positions of markers, rotation and other wonderfull things.

I have already managed to read out the distance between two markers using FLARManager using adams help and some maths. Now it was turn to implement Jiglib to be able to control things in AR and have them react to each other.

For an example and introduction to jiglib, I used an example in a book I have called Professional Papervision 3D. It has a Jiglib example where a globe is placed on a plane and you control it with the arrow keys. Ordinarily you wouldnt need a physics engine to handle this, but instead of making the globe slide around, it rolls. Ah the benifits of external libraries.

Anyway, the book also shows how to implement this example with FLARToolkit. Handy, but not really. After figuring out that both his code was old and out of date for Jiglib and that FLARManagers set up is completely different, I got it working.

Hilarious side note, for a while I hade everything upside down! Oh the fun I had.

In a while, there will be a video here to demonstrate how this works.

*update* video is now online after 14 hours of waiting.

I will do more tonight to show collisions better. Currently, collision detection is happening with the ball and the wireframe mesh that is acting as the floor, if this wasn’t there, the ball would just keep falling.

Another side note, I tweeted that I had achieved this, and put as a joke “so who wants to pay me to write a tutorial about this?” My editor from active tuts tweeted back saying he may be interested. Well, I know I can make some money out of this project if it’s not from people paying me to make things, it’s writing about how it’s done.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: