AR distance interaction

17 Oct

So, I just put together a basic demo to show that it works.

It does indeed work, just needs some refinement for the rendering of the cubes because currently, the cubes are created as one cube and then each marker defines a colour. This makes it a little tricky to turn individual cubes visibility on and off, so in this demo, only one cube may become visible when the markers are close together. Anyway, it shows that it works as it should. And pretty reliably I think.

By the way, the code to measure the distance is as follows:

if (evt.marker.patternId == 0){pattern0.x = evt.marker.x; pattern0.y = evt.marker.y;}
if (evt.marker.patternId == 1){pattern1.x = evt.marker.x; pattern1.y = evt.marker.y;}

That would go in the onMarkerUpdated function of FLARManager, and you declare the objects like so:

public var pattern0:Object = {patternID:0, x:0, y:0, active:0};
public var pattern1:Object = {patternID:1, x:0, y:0, active:0};

Thanks to Adam Martin, my tutor of Interactive Media for this bit of code.

DEMO TIME.

I use the same markers that I used for my tutorial series, grab the pdf here.

Print them off, cut them out and move them close together, when the centers reach 200 (somethings, flash doesnt tell you what these numbers are) then a cube appears. Heres a little image to show how far away roughly you need to be.

ACTUAL DEMO TIME

http://www.kablamo.co.uk/ARExamples/distanceExample1/DistanceExample1.html

Had to link because embedding in wordpress sucks ass.

*updated*

I changed the file so it’s less buggy. Now, instead of a cube appearing, both cubes are present from the start and when they get close enough together, they dissapear. Weeeee

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: