How to use the AssetLibrary for a Blender car model?

Software: Away3D 4.x

edgar, Member
Posted: 19 December 2011 10:30 AM   Total Posts: 52

I have created a car in Blender. The casing, wheels, interior have seperate meshes. Now I want to have all the meshes seperately in away3d with different textures.

From the example files on the away3d website, I have created this code:

/code
private function initObjects():void
  {
  AssetLibrary.enableParser(Max3DSParser);
 
  AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete);
  AssetLibrary.load(new URLRequest(“assets/smartroadster.3ds”));
 
 
  //create a ground plane
  groundMaterial = new BitmapMaterial((new groundColor()).bitmapData, true, true, true);
  groundMaterial.lights = [sunLight, skyLight];
  groundMaterial.shadowMethod = filteredShadowMapMethod;
  ground = new Plane(groundMaterial, 5000, 5000);
  ground.geometry.scaleUV(1, 1);
  ground.castsShadows = true;
  scene.addChild(ground);
 
 
  }
 
  private function onAssetComplete(event:AssetEvent):void
  {
  if(event.asset.assetType == AssetType.MESH)
  {
  //create material object and assign it to our mesh
  smartMaterial = new BitmapMaterial(new smartColor().bitmapData);
  smartMaterial.bothSides = true;
  smartMaterial.shadowMethod = filteredShadowMapMethod;
  smartMaterial.lights = [sunLight, skyLight];
  //smartMaterial.gloss = 50;
  smartMaterial.specular = 0.8;
  smartMaterial.ambientColor = 0xFFFFFF;
  smartMaterial.ambient = 0.5;
 
  //create mesh object and assign our animation object and material object
  mesh = event.asset as Mesh;
  mesh.material = smartMaterial;
  mesh.castsShadows = true;
  mesh.scale(100);
  mesh.z = 1000;
  mesh.y = 200;
  mesh.rotationY = -45;
  scene.addChild(mesh);
 
  //register our mesh as the lookAt target
  cameraController.lookAtObject = mesh;
 
  //default to breathe sequence
  }

/code

How do I put in the different meshes?

Thanks
Edgar

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X