Frage

I have FLARManager library for my application which does the basic augmented reality using FLARManagerTutorial_Collada.as from its examples. I want to have my cursor (or a movieclip) follow the imported 3D object on screen, but the cursors transformation is 2D and the object moves in 3D space. How can I do it?

this.modelContainer.transform = FLARPVGeomUtils.convertFLARMatrixToPVMatrix(this.activeMarker.transformMatrix);

This is transformation code for the 3D model container, but I don't know how to get the cursors X and Y values, as well as scale and/or rotation values from the 3D objects scale.

War es hilfreich?

Lösung

The solution appeared to be easy.

private var activeMarker:FLARMarker;

...

var xPos:Number = this.activeMarker.centerpoint.x;
var yPos:Number = this.activeMarker.centerpoint.y;
var scale:Number = this.activeMarker.vector3D.z;

This will give X and Y screen position of the seen marker and using this.activeMarker.vector3D.z, one can get depth of the recognized marker which can also be represented as "scale".

The 3D Model Container modelContainer transformation is the same as the Marker this.activeMarker transformation, that's whated to know.

I found the answer here: Inside FLARManager: 2D Marker Tracking

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top