How can I access the Planes in an ObjectContainer forming a Cube?

Software: Away3D 4.x

edgar, Member
Posted: 05 April 2012 10:51 AM   Total Posts: 52

How can I access or change the material of the planes in an ObjectContainer forming a cube.

The cube has the following code:


//ImageCube1
Front = new Mesh(new PlaneGeometry(planeDimX, planeDimY, 1, 1), FrontTexture1);
Front.rotationX = -90;
Front.z = -planeDimX/8;
 
Back = new Mesh(new PlaneGeometry(planeDimX, planeDimY, 1, 1), BackTexture);
Back.rotationX = -90;
Back.rotationY = 180;
Back.z = planeDimX/8;
   
Left = new Mesh(new PlaneGeometry(planeDimX/4, planeDimY, 1, 1), LeftTexture);
Left.x = planeDimX / 2;
Left.rotationX = 90;
Left.rotationY = 90;

Right = new Mesh(new PlaneGeometry(planeDimX/4, planeDimY, 1, 1), RightTexture);
Right.x = -planeDimX / 2;
Right.rotationX = 90;
Right.rotationY = -90;
 
Top = new Mesh(new PlaneGeometry(planeDimX, planeDimY/4, 1, 1), TopTexture);
Top.y = planeDimY / 2;
 
Bottom = new Mesh(new PlaneGeometry(planeDimX, planeDimY/4, 1, 1), TopTexture);
Bottom.y = -planeDimY / 2;
Bottom.rotationX = 180;
 
 
imageCube1 = new ObjectContainer3D();
//scene.addChild(imageCube1);
 
imageCube1.addChild(Front);
imageCube1.addChild(Back);
imageCube1.addChild(Left);
imageCube1.addChild(Right);
imageCube1.addChild(Top);
imageCube1.addChild(Bottom);

I have created an array, where I have cloned this cube:

for (i= 0; i < jLen; j++)
  { 
    cube = imageCube1.clone() as ObjectContainer3D;
    //cube.material.bothSides = true;
    cube.x =  radius*Math.sin(i*pStep)*Math.sin(j*tStep);
    cube.z = -radius*Math.sin(i*pStep)*Math.cos(j*tStep);
    cube.y = -radius*Math.cos(i*pStep);
          cube.rotati     cube.rotati * thetaStep;
   
    cubePosX = cube.x;
    cubePosY = cube.y;
    cubePosZ = cube.z;
    cuberotY = cube.rotationY;
    cuberotX = cube.rotationX;
   
    cubeRotXArray.push(cuberotX);
    cubeRotYArray.push(cuberotY);
    cubePosXArray.push(cubePosX);
    cubePosYArray.push(cubePosY);
    cubePosZArray.push(cubePosZ);
   
    //cube.addEventListener(MouseEvent3D.MOUSE_OVER, mouseOverCube);
    //cube.addEventListener(MouseEvent3D.MOUSE_OUT, mouseOutCube);
    //cube.addEventListener(MouseEvent3D.DOUBLE_CLICK, cubeClicked);
   
    Cubes.push(cube);
    cubesContainer.addChild(cube);
 
   
  }
  }

</code>

How can I get access to the planes of the cubes in Cubes in order to change the material?

Many thanks

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X