I am currently working on a school project where I am using Adobe Air
to try and create a periscope game for the Android platform.
I have been looking through multiple forums/tutorials to figure out
how to import models and have thankfully figured it out but for some
reason I am only able to import one model (a cow) and any other .dae I
try to import simply leaves me with a black white screen.

Does Away3d have a size restriction for importing 3d models? the cow I
have is only about 50kb where the others I have are at least 100kb.. I
would be very surprised if I was forced to only use models 50kb or
smaller but I have had a lot of trouble researching this.

I have included the code below, I would include the 3d models as well
but I have no idea how to attach items on this forum.

If anyone could help me figure out how to get other models to appear
it would be greatly appreciated. It baffles me that I am able to
import the cow model which is relatively detailed but no other model I
find. I was also able to make a cube appear (7kb).

I am at a loss right now on what to do and any help would be amazing.
Thank you in advance.

package
{
        import away3d.containers.ObjectContainer3D;
        import away3d.containers.View3D;
        import away3d.events.Loader3DEvent;
        import away3d.loaders.Collada;
        import away3d.loaders.Loader3D;

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

        public class Main extends Sprite
        {
                protected var cow:ObjectContainer3D;
                protected var view:View3D;
                protected var i:int = 0;


                public function Main()
                {
                        super();
                        
this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
                }

                protected function onAddedToStage(event:Event):void
                {
                        createChildren();
                        loadModel();
                        startRendering();
                }

                protected function createChildren():void
                {
                        view = new View3D({x:stage.stageWidth/2, 
y:stage.stageHeight/2});
                        addChild(view);
                }

                protected function loadModel():void
                {
                        var loader3D:Loader3D = 
Collada.load("daeModel/cow.dae");
                        loader3D.addEventListener(Loader3DEvent.LOAD_SUCCESS,
onModelLoadSuccess);
                }

                protected function onModelLoadSuccess(event:Loader3DEvent):void
                {

                        cow = event.loader.handle as ObjectContainer3D;
                        cow.scale(100);
                        cow.moveDown(1);
                        view.scene.addChild(cow);
                }

                protected function startRendering():void
                {
                        addEventListener(Event.ENTER_FRAME, onRenderTick);
                }

                protected function onRenderTick(event:Event = null):void
                {

                        //Render View
                        view.render();

                        //If our cow is ready - spin
                        if (cow)
                        {
                                cow.yaw(5);


                        }
                }
        }
}

Reply via email to