Away 3d 3.6 ActionScript3 Class meshes slow down applications.

Software: Away3D 3.x

Avatar
oladitan, Member
Posted: 13 August 2011 10:29 PM   Total Posts: 71

Hello I have exported a mesh from blender 2.58 as a Collada. I then converted this collada file into an ActionScript 3 class using prefab. When I load my actionscript class model into the scene, the applican runs very slow. Any tips to help this? My model has 5514 faces. here is a link to the SWF

thank you.http://www.swfcabin.com/open/1313272175

   

Avatar
Ringo Blanken, Administrator
Posted: 14 August 2011 07:31 AM   Total Posts: 120   [ # 1 ]

1. Less faces will help wink
2. What kind of renderer are you using ?
3. Post your code might be something else slowing it.

 Signature 

Freelancer: http://www.ringo.nl/en/
http://www.jiglibflash.com
http://www.awayphysics.com
http://www.away3d.com

   

Avatar
oladitan, Member
Posted: 14 August 2011 08:02 AM   Total Posts: 71   [ # 2 ]

I was using correct z order, I have switched to the BASIC rendered and the program has sped up allot. It is still a little bit slow.

http://www.swfcabin.com/open/1313305581

My model Class is given the variable “sphere”.

package  
{
 import away3d
.cameras.HoverCamera3D;
 
import away3d.cameras.SpringCam;
 
import away3d.cameras.TargetCamera3D;
 
import away3d.core.clip.FrustumClipping;
 
import away3d.core.geom.Frustum;
 
import away3d.core.render.Renderer;
 
import away3d.core.utils.Cast;
 
import away3d.materials.BitmapMaterial;
 
import away3d.primitives.Plane;
 
import away3d.primitives.Sphere;
 
import away3d.core.base.Mesh;
 
import away3d.core.base.Object3D;
 
 
import flash.events.Event;
 
import flash.events.KeyboardEvent;
 
import flash.events.MouseEvent;
 
 
/**
  * ...
  * @author Olubukola Laditan
  */
 
 
public class CameraDemo extends Away3DTemplate 
 {
  [Embed
(source 'checkerboard.jpg')protected var CheckerBoardTexture:Class;
  protected var 
sphere:Mesh;
  protected var 
hoverCamera:HoverCamera3D;
  protected var 
springCamera:SpringCam;
  protected var 
targetCamera:TargetCamera3D;
  protected var 
lastStageX:Number;
  protected var 
lastStageY:Number;
  protected var 
mouseButtonDown:Boolean;
  protected var 
moveForward:Boolean;
  protected var 
moveBackward:Boolean;
  protected var 
turnLeft:Boolean;
  protected var 
turnRight:Boolean;
  protected var 
dagh1:Mesh;
  
  public function 
CameraDemo() 
  
{
   super
();   
  
}
  
  
protected override function initEngine():void
  {
   super
.initEngine();   
   
view.renderer Renderer.BASIC;
   
view.clipping = new FrustumClipping();
  
}
  
  
protected override function initScene():void
  {
   super
.initScene();
   
sphere = new CharacterA();   
   
scene.addChild(sphere);
   
   
//dagh1 = new CubeA();
   //scene.addChild(dagh1);
   
   
var plane:Plane = new Plane(
    
{
     material
: new BitmapMaterial(Cast.bitmap(CheckerBoardTexture)),
     
width500,
     
height500
    }
   
);
   
//scene.addChild(plane);
   
   
addHoverCamera();
  
}
  
  
protected override function initListeners():void
  {
   super
.initListeners();
   
stage.addEventListener(MouseEvent.MOUSE_DOWNonMouseDown);
   
stage.addEventListener(MouseEvent.MOUSE_UPonMouseUp);
   
stage.addEventListener(MouseEvent.MOUSE_MOVEonMouseMove);
   
stage.addEventListener(KeyboardEvent.KEY_DOWNonKeyDown);
   
stage.addEventListener(KeyboardEvent.KEY_UPonKeyUp);
  
}
  
  
protected override function onEnterFrame(event:Event):void
  {
   super
.onEnterFrame(event);
   
   if (
hoverCamera != nullhoverCamera.hover();
   if (
springCamera != nullspringCamera.view;
   
   if (
moveForwardsphere.moveForward(5);
   else if (
moveBackwardsphere.moveBackward(5);
   if (
turnLeftsphere.yaw(-5);
   else if (
turnRightsphere.yaw(5);
  
}
  
  
protected function onMouseDown(event:MouseEvent):void
  {
   mouseButtonDown 
true;
   
lastStageX event.stageX;
   
lastStageY event.stageY;
  
}
  
  
protected function onMouseUp(event:MouseEvent):void
  {
   mouseButtonDown 
false;
  
}
  
  
protected function onKeyDown(event:KeyboardEvent):void
  {
   
switch (event.keyCode)
   
{
    
case 38// UP ARROW
     
moveForward true;
     break;
    case 
40// DOWN ARROW
     
moveBackward true;
     break;
    case 
37// LEFT ARROW
     
turnLeft true;
     break;
    case 
39// RIGHT ARROW
     
turnRight true;
     break;     
   
}
  }
  
  
protected function onKeyUp(event:KeyboardEvent):void
  {
   
switch (event.keyCode)
   
{
    
case 38// UP ARROW
     
moveForward false;
     break;
    case 
40// DOWN ARROW
     
moveBackward false;
     break;
    case 
37//LEFT ARROW
     
turnLeft false;
     break;
    case 
39//RIGHT ARROW
     
turnRight false;
     break;
    case 
49//1
     
addHoverCamera();
     break;
    case 
50//2
     
addSpringCamera();
     break;
    case 
51// 3
     
addTargetCamera();
     break;
   
}
  }
  
  
protected function addTargetCamera():void
  {
   hoverCamera 
null;
   
springCamera null;
   
   
targetCamera = new TargetCamera3D(
    
{
     target
sphere,
     
y100
    }
   
); 
   
   
view.camera targetCamera;
  
}
  
  
protected function addHoverCamera():void
  {
   springCamera 
null;
   
targetCamera null;
   
   
hoverCamera = new HoverCamera3D(
    
{
     target
sphere,
     
distance100,
     
mintiltangle5,
     
tiltAngle45
    }
   
);
   
   
view.camera hoverCamera;
  
}
  
  
protected function onMouseMove(event:MouseEvent):void
  {
   
if (mouseButtonDown && hoverCamera != null)
   
{
    
var pan:int = (event.stageX lastStageX);
    var 
tilt:int = (event.stageY lastStageY);
    
    
hoverCamera.panAngle += pan;
    
hoverCamera.tiltAngle += tilt;
    
    
lastStageX event.stageX;
    
lastStageY event.stageY;
   
}
  }
  
  
protected function addSpringCamera():void
  {
   hoverCamera 
null;
   
targetCamera null;
   
   
springCamera = new SpringCam();
   
springCamera.target sphere;
   
view.camera springCamera;
  
}
  
 }

thank you.

   

Avatar
Ringo Blanken, Administrator
Posted: 14 August 2011 07:53 PM   Total Posts: 120   [ # 3 ]

Yea z-order cost a lot performance, what you can do is change frustrum to rectangle clipping and get less faces on the model smile
Or upgrade to away4.0 for fp11 beta player.

Good luck.

 Signature 

Freelancer: http://www.ringo.nl/en/
http://www.jiglibflash.com
http://www.awayphysics.com
http://www.away3d.com

   

Avatar
oladitan, Member
Posted: 15 August 2011 10:24 PM   Total Posts: 71   [ # 4 ]

thank you for the help.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X