i need some help

Software: Away3D 3.x

Lilith von Einzbern, Newbie
Posted: 04 July 2012 12:43 PM   Total Posts: 4

im korean student studing programing use away3d.

i got a problem when i coding show up some 3D Object

this is problem code :

protected function init_gun_assembly_locate():void{

   turret_S_wheel
.= -3.125;
   
turret_S_wheel.rotationX 90;
   
turret_barrel.150;
   
turret_barrel.= -18.75;
   
turret_barrel.rotationZ 90;
   
turret_barrel_body.37.5;
   
turret_barrel_body.= -18.75;
   
turret_guard.= -31.5;

  
}
  
  
protected function init_assembly_gun_set():void{
   assembly_gun_RL 
= new ObjectContainer3D(turret_S_wheel,turret_barrel,turret_barrel_body,turret_guard,{z:0});
   
assembly_gun_RU = new ObjectContainer3D(turret_S_wheel,turret_barrel,turret_barrel_body,turret_guard,{z:0});
   
assembly_gun_RU.100;
   
   
assembly_gun_set = new ObjectContainer3D(assembly_gun_RL,assembly_gun_RU);
   
   
scene.addChild(assembly_gun_set);
  

i make two Container use one variable setting

multiple “assembly_gun_XX” but just show up one Object.

some body help me!

 

   

Richard Olsson, Administrator
Posted: 04 July 2012 04:21 PM   Total Posts: 1192   [ # 1 ]

If you add the same object twice, it will still only be one object. Compare to how the regular Flash display list works. Just adding the same sprite twice (using addChild()) doesn’t mean there will be two sprites. The second addChild() just moves the sprite in the display list, and similarly, your second container just moves the objects to that container.

Take a look inside the container constructor, and you’ll see that it just uses addChild() to add the arguments as children.

If you want to have several clones, you have to create them individually.

   

Lilith von Einzbern, Newbie
Posted: 05 July 2012 01:26 AM   Total Posts: 4   [ # 2 ]

that means make
variables ‘turret_S_wheel_1, turret_S_wheel_2, ... turret_S_wheel_n’
for containers ‘assembly_gun_1, assembly_gun_2, ... assembly_gun_n’?

isn’t solution just use one variable and clone(or copy, duplicate) the same variable different name?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X