I am creating a "rubiks cube" 3 x matrix of planes. I create each plane by offsetting its x,Y and Z from the center, then adding it to an ObjectContainer3D. Then I rotate the ObjectContainers so that the planes are facing the right direction. This works great. But then I use applyRotations() to each plane, and the planes suddenly shift out of position. Can anybody help me come up with a fix?
Here is the positioning of the plane inside the objectContainer3D:
var sidehalfwidth:Number = 1.0 * spacer;
plane.x = sidehalfwidth - (index % 3 * spacer);
plane.z = sidehalfwidth - (Math.floor(index / 3) *
spacer);
plane.y = 1.5 * spacer;
here is the rotation function. the count variable is the face of the
cube it is oriented to:
var t:Tile = new Tile(i, count);
tiles.push(t);
switch(count) {
case 0:
// no rotations.
break;
case 1:
t.rotationY = 180;
t.rotationX = 90;
t.filters = [new GlowFilter(0)];
break;
case 2:
t.rotationX = 90;
t.rotationY = 90;
//t.rotationZ = 90;
break;
break;
case 3:
t.rotationX = 90;
break;
case 4:
//t.rotationZ = -90;
t.rotationX = 90;
t.rotationY = -90;
//t.rotationY = 90;
break;
case 5:
t.rotationZ = 180;
break;
}
