Shortly after FLARToolkit was married to Sandy, I arranged it a secret date with Alternativa3D. The date was quite fruitful, and in a week this baby was born:
This is modified “Ballance” game released by Alternativa3D team in november, with FLARToolkit used to control camera instead of mouse. Unfortunately, due to GPL2 section 2 clause B I cannot distribute stuff including both FLARToolkit and Alternativa3D for free, so no SWF for you to play with atm, sorry. But, if anyone is interested in sponsorship to enable this thing to go online, contact me.
On the technical side (aka “how the hell was it done”), bad news are that neither object transformation matrix nor camera projection matrix cannot be directly set in Alternativa3D, so we have to resort to mind-f@#king tricks to get it working, and the result is only approximate match. Good news are that this approximation is, obviously, good enough and useable. An example of what has to be done to make it work can be found here (I believe my single AS file does not contain FLARToolkit, and so I can distribute it, under whatever license I want).
Very cool. I saw some cool things yesterday at GA Tech, and this Augmented Reality technology is going to be very cool when you add in mobile devices.
hey there i just found you googling something. great work. i like it very much. great use of the marker position to physics relationship. cool little game. pac man, i see it comming allready.
hey im trying to do the same game except its with wiimote.
Is there any way i can get the code from 4? it will make my life so easy :)
The code was released by alternativa team at 1st flashgamm conference last year, and is available for download here.
hey makc, i’d like to roll in support for other 3D engines into FLARManager. was taking a look at your SimpleTest.as, and i noticed that you translate a FLAR matrix into a new matrix for use with Alternativa3D, but then you manually set props on a Camera3D instance like rotationX, etc, rather than directly applying that matrix to an Object3D.
why is this? is this an idiosyncrasy of Alternativa3D? i.e. is it not possible to just apply a matrix to an object like you can in PV3D / flash?
unfortunately, in Alternativa3D transform matrix is read only.
damn, this is so nice.
Makc the great!
now where do I find a sponsor who thinks the same :) FlashGameLicense was not helpful so far.
Hey, very nice demo. I like it =)
How much you looking for sponsorship? if you like we can disscust it via icq(146558873) or skype(mr.Badim).
если спонсора не нашел, пиши =) что-нибудь придумаем.
very nice. esp like the transparency.
hey… great work on this.
getting stuck into flarToolkit and Alternativa3D.
Maybe you can explain more about the work around for the transform matrix being read only?
I have my FLARTransMatResult picked up from my AR Marker…
How do I get my Object3DContainer to react to this?
thanks
although this post was made more than a year ago, when alternativa was still 5th version, I think “the work around” is pretty much the same today, you calculate approximate scales/rotations/translations from matrix values. try same bit of code; but keep in mind that things like axes signs and rotations order might have changed.
Hi makc3d,
I’m a bit of a newbie when it comes to matrix values…
i see the FLARTransMatResult gives me a 4×3 matrix…(i think)
do i use this to figure out scales/rotations/translations..??
There’s a link to AS file up there :)
Ive been looking at the code but Im not sure where you are getting the FLARTransMatResult from the augmented marker?
Ive been looking at your SimpleTest.as and have come up with the following to use flash.geom.matrix3d
but its quiet right… and its seriously slow!
if (detector.detectMarkerLite(raster, _threshold) && detector.getConfidence() > 0.5)
{
//Get the transfomration matrix for the current marker position
this.detector.getTransformMatrix(flarTransMatResult);
//create the 3d matrix
var somePoints:Vector. = new Vector.();
somePoints[0] = flarTransMatResult.m00; //ma
somePoints[1] = flarTransMatResult.m01; //mb
somePoints[2] = flarTransMatResult.m02; //mc
somePoints[3] = flarTransMatResult.m03; //md
somePoints[4] = flarTransMatResult.m10; //me
somePoints[5] = flarTransMatResult.m11; //mf
somePoints[6] = flarTransMatResult.m12; //mg
somePoints[7] = flarTransMatResult.m13; //mh
somePoints[8] = flarTransMatResult.m20;//MI
somePoints[9] = flarTransMatResult.m21; //mj
somePoints[10] = flarTransMatResult.m22; //mk
somePoints[11] = flarTransMatResult.m23; //mL
somePoints[12] = 0;
somePoints[13] = 0;
somePoints[14] = 0;
somePoints[15] = 0;
m = new Matrix3D(somePoints); //load in the matrix…
//var obj:Object3D = rootContainer;
var obj:Object3D = flarCamera3D;
m.invert();
// m is not scaled, but we shall calculate scales any way, just to be NaN-safe
var sx:Number = Math.sqrt (m.rawData[0] * m.rawData[0] + m.rawData[4] * m.rawData[4] + m.rawData[8] * m.rawData[8]);
var sy:Number = Math.sqrt (m.rawData[1] * m.rawData[1] + m.rawData[5] * m.rawData[5] + m.rawData[9] * m.rawData[9]);
var sz:Number = Math.sqrt (m.rawData[2] * m.rawData[2] + m.rawData[6] * m.rawData[6] + m.rawData[10] * m.rawData[10]);
var sinY:Number = m.rawData[8] / sx;
if (-1 < sinY && sinY 0) ? -Math.PI / 2 : Math.PI / 2;
obj.rotationX = 0;
obj.rotationZ = Math.atan2 (-m.rawData[1], m..rawData[5]);
}
obj.x = m.rawData[3];
obj.y = m.rawData[7];
obj.z = m.rawData[11];
}
I meant to say its “not” quiet right…!
I see you already have found right bit of code and started playing around with it – from here to your end result it is supposed to be played in solo :) I can’t really help you here as long as we aren’t sitting in the same room. One thing I can say, your performance problem is not in this code.
Of course, none of these trix are neccessary in a3d7, since matrix has setter now, no?
I don’t know, gavin said it’s still read-only and I havent checked. If it has a setter, then yes – you just set it.
Hi! Great work you have here!
I saw above that you calculate scales, even if m is not scaled. (That is, scaleX and scaleY are 1). Well, I was wondering… but how is the 3D object scaled anyway? Supposing I want to overlap a rectangle over the marker. How can I scale it?
Thank you for your time!
Claudia
Add your object to base node as a child, then transform it any way you want (including scale).
Thanks for the tip, but I didn’t wanted to use the setTransfMatrix method. Because I want to transform an image, not a 3D object.
Claudia, use FLARManager instead of FLARToolkit, it’s doing wonder for me.
Thanks! I will try! :)
for 2D overlay use this code http://wonderfl.net/c/sxQJ on FLARSquare corners
Thanks! Exactly what I needed! :)