i got a new problem

Software: Away3D 3.x

Lilith von Einzbern, Newbie
Posted: 05 July 2012 12:03 PM   Total Posts: 4
package
{
 import away3d
.cameras.Camera3D;
 
import away3d.containers.Scene3D;
 
import away3d.containers.View3D;
 
import away3d.primitives.*;
 
 
import flash.display.Sprite;
 
import flash.events.Event;

 
 public class 
TurretDefence extends Sprite
 {
  
protected var scene:Scene3D;
  protected var 
camera:Camera3D;
  protected var 
view:View3D;
  
  
  public function 
TurretDefence():void
  {
   initUI
();
   
initEngine();
   
initScene();
   
initListener();
  
}
  
  
protected function initEngine():void{
   view 
= new View3D();
   
scene view.scene;
   
camera view.camera;
   
addChild(view);
   
   
view.stage.stageWidth/2;
   
view.stage.stageHeight/2;
  
}
  
  
protected function initListener():void{
   addEventListener
(Event.ENTER_FRAME,onEnterFrame);
  
}
  
  
protected function onEnterFrame(event:Event):void{
   view
.render();
  
}
  
  
protected function initScene():void{
   
throw new Error"override initScene");
  
}
  
  
protected function initUI():void{
   
throw new Error"override initUI");
  
}
 }
}

package turret
{
 import away3d
.containers.ObjectContainer3D;
 
import away3d.core.base.Object3D;
 
import away3d.primitives.Sphere;
 
 
import flash.events.Event;
 
 public class 
turret_assembly_set extends TurretDefence
 {
  
protected var turret_:ObjectContainer3D = new turret_assembly_body().body_set;
  protected var 
turret_:ObjectContainer3D = new turret_assembly_gun().gun_set;
  protected var 
turret_gun_set2:ObjectContainer3D = new turret_assembly_gun().gun_set;
  protected var 
turret_gun_set3:ObjectContainer3D = new turret_assembly_gun().gun_set;
  protected var 
turret_gun_set4:ObjectContainer3D = new turret_assembly_gun().gun_set;
  protected var 
turret_stand:Object3D = new turret_root().modeling;
  protected var 
turret_set:ObjectContainer3D;

  
  public var 
turret_set:ObjectContainer3D;
  public function 
turret_assembly_set()
  
{
   super
();
  
}
  
protected override function onEnterFrame(event:Event):void{
   super
.onEnterFrame(event);
   
   
// Scene Rotation (for view polygons. just for debug)
   //scene.rotationX += 1;
   
scene.rotationY += 1;
   
//scene.rotationZ += 1;

  
}
  
protected function assembly_gun_body():void{
   turret_set 
= new ObjectContainer3D(
    
turret_,
    
turret_,
    
turret_gun_set2,
    
turret_gun_set3,
    
turret_gun_set4,
    
{x:0,y:0,z:0}
   
);
  
}
  
protected function gun_location():void{
   
//Left Lower
   
turret_.50;
   
turret_.= -25;
   
turret_.rotationX 180;
   
turret_.25;
   
   
//Left Upper
   
turret_gun_set2.50;
   
turret_gun_set2.45;
   
turret_gun_set2.rotationX 180;
   
   
//Right Lower
   
turret_gun_set3.= -50;
   
turret_gun_set3.= -25;
   
turret_gun_set3.25;
   
   
//Right Upper
   
turret_gun_set4.= -50;
   
turret_gun_set4.45;
  
}

  
protected function inits():void{
   turret_stand
.= -115.625;
   
turret_set = new ObjectContainer3D(
    
turret_stand,
    
turret_set,
    
{x:0,y:0,z:0}
   
);
   
scene.addChild(turret_set);
  
}
  
protected override function initScene():void{
   super
.initScene();
   
gun_location();
   
assembly_gun_body();
   
inits();
  
}
  
  
protected override function initListener():void{
   super
.initListener();
  
}
  
  
protected override function initEngine():void{
   super
.initEngine();
  
}
  
  
protected override function initUI():void{
   super
.initUI();
  
}
  
 }

i solved yesterday’s problem.

but i got a new problem.

that’s shown up Object very well before some code modifed.

even though i use ‘scene.addChild(turret_set);’, no Object show up.

   

Richard Olsson, Administrator
Posted: 11 July 2012 08:33 AM   Total Posts: 1192   [ # 1 ]

Your code is a bit confusing really. I think you should really stop using the constructor approach of adding children, and start using the addChild() method of ObjectContainer3D instead. That will make your code much clearer, and hopefully you will be able to figure out what you’re doing wrong.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X