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.x = stage.stageWidth/2;
view.y = 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_.z = 50;
turret_.y = -25;
turret_.rotationX = 180;
turret_.x = 25;
//Left Upper
turret_gun_set2.z = 50;
turret_gun_set2.y = 45;
turret_gun_set2.rotationX = 180;
//Right Lower
turret_gun_set3.z = -50;
turret_gun_set3.y = -25;
turret_gun_set3.x = 25;
//Right Upper
turret_gun_set4.z = -50;
turret_gun_set4.y = 45;
}
protected function inits():void{
turret_stand.y = -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.