animation breaks the model

Software: Away3D 3.x

ge5, Newbie
Posted: 15 July 2011 09:21 PM   Total Posts: 13

i am new to away 3d, though familiar w/papervision 3d. In going through “essentials” book examples, am stuck on trouble with embedded collada eg. in chap 6 and setting animated model to “play”,. model totally screws up and only assembles properly if animation is disabled. i am including a zip with the collada, etc. any help will be really appreciated!!

package
{
import away3d.containers.ObjectContainer3D;
import away3d.core.utils.Cast;
import away3d.loaders.Collada;
import away3d.loaders.data.AnimationData;
import away3d.materials.BitmapMaterial;

import flash.events.Event;

public class mT extends template
{
  //[Embed(source = “NU22.dae”,mimeType = “application/octet-stream”)]
  [Embed(source = “modelo.dae”,mimeType = “application/octet-stream”)]
  protected var ColladaModel:Class;
  [Embed(source = “scout_flat.jpg”)]
  //[Embed(source = “nu2.jpg”)]
  protected var ColladaMaterial:Class;
 
  public function mT()
  {
  super();
  }
 
  public override function initScene():void
  {
  super.initScene();
  var modelMaterial:BitmapMaterial = new BitmapMaterial(Cast.bitmap(ColladaMaterial));
  var colladaContainer:ObjectContainer3D = Collada.parse(Cast.bytearray(ColladaModel),
  {
    materials:
    {
    //“Material-material”: modelMaterial
    “scout_red”:modelMaterial
    //monster: modelMaterial
    },
    rotationY: 0
    //yUp: false,
    //bothsides: true,
    //ownCanvas: true
  }
  );
 
  colladaContainer.scaleX= colladaContainer.scaleY=colladaContainer.scaleZ=1;
  //colladaContainer.scaleY = 1;
  //colladaContainer.scaleZ = 1;
  colladaContainer.y= -100;
  scene.addChild(colladaContainer);
  var animationData:AnimationData = colladaContainer.animationLibrary.getAnimation(“default”);
  if (animationData != null)
  {
  animationData.animator.play();
  }
 
  }
}
}
////////////////////////////////////////////////////////
package
{

import flash.display.Sprite;
import away3d.cameras.Camera3D;
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import flash.events.Event;


public class template extends Sprite
{
 
  protected var scene:Scene3D;
  protected var camera:Camera3D;
  protected var view:View3D;
 
 
 
  public function template()
  {
  //initUI();
  initEngine();
  initScene();
  initListeners();
  }
 
  protected function initEngine():void {
 
  view = new View3D();
  camera = new Camera3D();
  scene = view.scene;
  camera = view.camera;
  addChild(view);
  view.x = stage.stageWidth / 2;
  view.y = stage.stageHeight / 2;
  }
 
  protected function initListeners():void {
  addEventListener(Event.ENTER_FRAME, onEnterFrame);
  }
 
  protected function onEnterFrame(event:Event):void {
 
  view.render();
}
 
public function initScene():void {


}
//public function initUI():void {}



//}



}

}

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X