またFLARToolkit + WOWEngineとか
FLARToolkit + WOWEngineとか
の続き。
マーカー
Corocoro2.swf
Corocoro2.as
http://gihyo.jp/design/feature/01/flartoolkit/0003を参考にしたらだいぶんシンプルになった。
[actionscript]
private function _onEnterFrame(e:Event = null):void {
this._capture.bitmapData.draw(this._video);
if (this._detector.detectMarkerLite(this._raster, 80) && this._detector.getConfidence() > 0.5) {
this._detector.getTransformMatrix(this._resultMat);
this._baseNode.setTransformMatrix(this._resultMat);
var localRot:Matrix3D = Matrix3D.euler2matrix(new Number3D(0, 180, 90));
var rotMat:Matrix3D = Matrix3D.multiply3x3(this._baseNode.transform, localRot);
_rot = Matrix3D.matrix2euler(rotMat);
_ba.setRotation(0,0,_rot.z);
_wow.step();
_cube.rotationX = _rot.x;
_cube.rotationY = _rot.y;
_cube.rotationZ = _rot.z;
_cube.x = _baseNode.x;
_cube.y = _baseNode.y;
_cube.z = _baseNode.z;
_sphere.x = _baseNode.x + _particle.px;
_sphere.y = _baseNode.y + _particle.py;
_sphere.z = _baseNode.z + _particle.pz;
_sphere.visible = true;
_cube.visible = true;
} else {
_sphere.visible = false;
_cube.visible = false;
}
this._renderer.render();
}
[/actionscript]