ARMessageCard

In the Spark meeting #09, I presented an ARMessageCard for Geoff. At first, a card on the marker seems to be white, but a message will be rose by particles moves if you tilt the card. It works like a sand painting.

ARMessageCard from Yoshihiro Shindo on Vimeo.

You can try it at here (Please use this marker). Of course, source code was uploaded.

A point of this Flash is calculating gravity from the inclination of the card to move particles.

If you defined variables like:

private var _mat:Matrix3D = new Matrix3D();
private var _rot:Number3D = Number3D.ZERO;
private var _v:Number3D = new Number3D();

*Matrix3D and Number3D are provided by Papervision3D.

You can get gravity by the following code:

_mat.copy(_baseNode.transform);
_mat.invert();
_rot = Matrix3D.matrix2euler(_mat, _rot);
_v.reset(0, 1, 0);
_v.rotateY(_rot.y);
_v.rotateX(_rot.x);
_v.rotateZ(_rot.z);
var gx:Number = -_v.x * 2.0;
var gy:Number = -_v.y * 2.0;

*_baseNode is provided by FLARToolKit.

First, invert the transform matrix calculated by the FLARToolKit to get a transform matrix of gravity about the marker. Next, apply only rotations from the transform matrix to a normalized vector for gravity. Finally, get x value and y value from it. If you move particles based on these values, it will work fine :)

Follow me on Twitter