Hi,

I've moved the Morpher (core.base.Morpher) to Away3D Lite (actually
I'm using the haXe version, but same difference), and got it working
perfectly with geometry created programmatically ie "new Sphere(...);"
but am having trouble getting it to work with Collada objects.

I'm guessing this is something to do with Collada objects (those given
by .parseGeometry) are different in some way. The problem I'm facing
is that anything I send to the Morpher from parseGeometry just has an
empty vertices Vector<Float>.

My code looks as follows:

-----------------------------------------------------------------------------------------

        override private function init():Void
        {
                super.init();

                var daeData1 = Resource.getString("dae1");
                var daeData2 = Resource.getString("dae2");

                var c0 = new Collada();
                var c1 = new Collada();
                var c2 = new Collada();

                m0 = cast c0.parseGeometry(daeData1);
                m1 = cast c1.parseGeometry(daeData1);
                m2 = cast c2.parseGeometry(daeData2);

                mv0 = c0.geometryLibrary.getGeometryArray()[0].vertices;
                mv1 = c1.geometryLibrary.getGeometryArray()[0].vertices;
                mv2 = c2.geometryLibrary.getGeometryArray()[0].vertices;

                scene.addChild(m1);

                mp = new Morpher(mv1);

                addEventListener(Event.ENTER_FRAME, ef);
        }

        private function ef(event:Event):Void
        {
                super.onEnterFrame(event);

                m0.rotationY = -180 + 360 * (mouseX / stage.stageWidth);
                m1.rotationY = -180 + 360 * (mouseX / stage.stageWidth);
                m2.rotationY = -180 + 360 * (mouseX / stage.stageWidth);

                mp.start();
                mp.mix(m2, Math.sin(Lib.getTimer()/1000)*100000);
                mp.finish(m0);

                view.render();
        }

-----------------------------------------------------------------------------------------

The test I've done with spheres seems to be giving the correct
results, although I'm worried I'm missing something. You'll see I've
also created references to the objects inside the geometryLibraries
which I think would work but then you have to pass the Vectors
themselves to the Morpher and thus completely changing how it works.

So I guess the question comes down to "How do I get access to the
geometry as a Mesh from parseGeometry / a Collada"?

Reply via email to