Ciao a tutti! Ho un problema che mi sta causando non poche notti insonni.
Premetto che non sono un programmatore ma un grafico, ho come task per il corso di illustrazione di realizzare delle illustrazioni 3d in A.R.
tutto, con molta fatica e un pò di mal di testa, è andato a buon fine
riesco a creare collada - animarli - importarli - visualizzarli sul marker e avere multimarkers

ma....

prob1:
per ogni marker carico solo 1 modello... a me servirebbe caricare più di un dae per marker, per creare scene composite

prob2:
l'alpha è un mistero ancora per me... come posso far apparire e sparire modelli ed oggetti con fading? Ho provato da maya a dare 1 valore alpha al materiale ed animarlo ma... nell'export non risulta. Ho letto che questo va fatto in pv3d creando 1 layier di animazione..e sono confuso.

prob3:
in flash ero abituato agli event listener etc per concatenare animazioni nella timeline.. questo con i collada non è possibile, vero?

HELPP VI PREGOOO
grazie in anticipo





Posto il codice:
package examples {
import com.transmote.flar.FLARManager;
import com.transmote.flar.camera.FLARCamera_PV3D;
import com.transmote.flar.marker.FLARMarker;
import com.transmote.flar.marker.FLARMarkerEvent;
import com.transmote.flar.tracker.FLARToolkitManager;
import com.transmote.flar.utils.geom.PVGeomUtils;

import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;

import org.papervision3d.cameras.Camera3D;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.parsers.DAE;
import org.papervision3d.render.LazyRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;

/**
* FLARManager_Tutorial3D demonstrates how to display a Collada-formatted model
* using FLARManager, FLARToolkit, and Papervision3D.
* see the accompanying tutorial writeup here:
* http://words.transmote.com/wp/flarma...ollada-models/
*
* the collada model used for this example, scout.dae, was produced by Tom Tallian:
* http://tomtallian.com
*
* @author Eric Socolofsky
* @url http://transmote.com/flar
*/
public class FLARManagerTutorial_Collada_PV3D extends Sprite {
private var flarManager:FLARManager;

private var scene3D:Scene3D;
private var camera3D:Camera3D;
private var viewport3D:Viewport3D;
private var renderEngine:LazyRenderEngine;
private var pointLight3D:PointLight3D;

private var activeMarker:FLARMarker;
private var modelContainerisplayObject3D;


public function FLARManagerTutorial_Collada_PV3D () {
this.addEventListener(Event.ADDED_TO_STAGE, this.onAdded);
}

private function onAdded (evt:Event) :void {
this.removeEventListener(Event.ADDED_TO_STAGE, this.onAdded);

// pass the path to the FLARManager xml config file into the FLARManager constructor.
// FLARManager creates and uses a FLARCameraSource by default.
// the image from the first detected camera will be used for marker detection.
// also pass an IFLARTrackerManager instance to communicate with a tracking library,
// and a reference to the Stage (required by some trackers).
this.flarManager = new FLARManager("../resources/flar/flarConfig.xml", new FLARToolkitManager(), this.stage);

// to switch tracking engines, pass a different IFLARTrackerManager into FLARManager.
// refer to this page for information on using different tracking engines:
// http://words.transmote.com/wp/inside...cking-engines/
// this.flarManager = new FLARManager("../resources/flar/flarConfig.xml", new FlareManager(), this.stage);
// this.flarManager = new FLARManager("../resources/flar/flarConfig.xml", new FlareNFTManager(), this.stage);

// add FLARManager.flarSource to the display list to display the video capture.
this.addChild(Sprite(this.flarManager.flarSource)) ;

// begin listening for FLARMarkerEvents.
this.flarManager.addEventListener(FLARMarkerEvent. MARKER_ADDED, this.onMarkerAdded);
this.flarManager.addEventListener(FLARMarkerEvent. MARKER_UPDATED, this.onMarkerUpdated);
this.flarManager.addEventListener(FLARMarkerEvent. MARKER_REMOVED, this.onMarkerRemoved);

// wait for FLARManager to initialize before setting up Papervision3D environment.
this.flarManager.addEventListener(Event.INIT, this.onFlarManagerInited);
}

private function onFlarManagerInited (evt:Event) :void {
this.flarManager.removeEventListener(Event.INIT, this.onFlarManagerInited);

this.scene3D = new Scene3D();
this.viewport3D = new Viewport3D(this.stage.stageWidth, this.stage.stageHeight);
this.addChild(this.viewport3D);

this.camera3D = new FLARCamera_PV3D(this.flarManager, new Rectangle(0, 0, this.stage.stageWidth, this.stage.stageHeight));

this.renderEngine = new LazyRenderEngine(this.scene3D, this.camera3D, this.viewport3D);

this.pointLight3D = new PointLight3D();
this.pointLight3D.x = 1000;
this.pointLight3D.y = 1000;
this.pointLight3D.z = -1000;

// load the model.
// (this model has to be scaled and rotated to fit the marker; every model is different.)
var cowAE = new DAE(true, "cow", true);
model.load("assets/scout.dae");
cow.moveDown(100);
cow.scale = 3;
cow.pitch(-30);
default_scene.addChild(cow);


var modelAE = new DAE(true, "model", true);
model.load("../resources/assets/scout.dae");
model.rotationX = 90;
model.rotationZ = 0;
model.scale = 30;


// create a container for the model, that will accept matrix transformations.
this.modelContainer = new DisplayObject3D();
this.modelContainer.addChild(model);
this.modelContainer.visible = false;
this.scene3D.addChild(this.modelContainer);

// create a plane
var material:ColorMaterial = new ColorMaterial(0x000000,0.5);
var plano:Plane = new Plane(material,100,100,5,5);
this.modelContainer2 = new DisplayObject3D();
this.modelContainer2.addChild(cow);
this.modelContainer2.visible = true;
this.scene3D.addChild(this.modelContainer2);

this.addEventListener(Event.ENTER_FRAME, this.onEnterFrame);
}

private function onMarkerAdded (evt:FLARMarkerEvent) :void {
trace("["+evt.marker.patternId+"] added");
this.modelContainer.visible = true;
this.modelContainer2.visible = true;

this.activeMarker = evt.marker;
}

private function onMarkerUpdated (evt:FLARMarkerEvent) :void {
//trace("["+evt.marker.patternId+"] updated");
this.modelContainer.visible = true;
this.activeMarker = evt.marker;
}

private function onMarkerRemoved (evt:FLARMarkerEvent) :void {
trace("["+evt.marker.patternId+"] removed");
this.modelContainer.visible = false;
this.activeMarker = null;
}

private function onEnterFrame (evt:Event) :void {
// apply the FLARToolkit transformation matrix to the Cube.
if (this.activeMarker) {
this.modelContainer.transform = PVGeomUtils.convertMatrixToPVMatrix(this.activeMar ker.transformMatrix);
}

// update the Papervision3D view.
this.renderEngine.render();
}
}
}