wireCube simulation with LineSegment

Software: Away3D 3.x

xlaplaze, Newbie
Posted: 29 December 2011 06:24 PM   Total Posts: 1

hello everyone, I hope you can help me
(I’m a beginner on away3D, and my english is not perfect)

here’s my intention:
I try to create a simple cube without wireframe
and I want to create a second cube with wireframe. That second cube is using the vertices of the first Cube.
But the result is not what I expected, because the dimension of the second
cube seem twice bigger ...????

So could you tell me what Is wrong ... why are the dimension of the second cube twice bigger than
the first one ?

(Of course, I know that I can use an Instance of Class WireCube, but
my goal is to achieve the same result using LineSegment)

Thank’s a lot, if you can help !!


—————————————————————————————

function clickCubeSegment(evt:MouseEvent){

var cubeSegment : Cube = new Cube();

cubeSegment.x = 100;
cubeSegment.y = 100;

cubeSegment.width = 60;
cubeSegment.height = 60;
cubeSegment.depth = 60;

var cubeMaterialsDataBlue:CubeMaterialsData= new CubeMaterialsData;

cubeMaterialsDataBlue.front = new ColorMaterial(0xCCE6FF);
cubeMaterialsDataBlue.back = new ColorMaterial(0xCCE6FF);
cubeMaterialsDataBlue.left = new ColorMaterial(0xCCE6FF);
cubeMaterialsDataBlue.right = new ColorMaterial(0xCCE6FF);

cubeSegment.cubeMaterials = cubeMaterialsDataBlue;

scene.addChild(cubeSegment);

// drawLine entre certains sommets
// il y a 8 sommet soit 12 segment

drawLine(cubeSegment.vertices[0],cubeSegment.vertices[1],0xFF0000);
drawLine(cubeSegment.vertices[0],cubeSegment.vertices[2],0xFF0000);
drawLine(cubeSegment.vertices[0],cubeSegment.vertices[5],0xFF0000);
drawLine(cubeSegment.vertices[1],cubeSegment.vertices[3],0xFF0000);
drawLine(cubeSegment.vertices[1],cubeSegment.vertices[4],0xFF0000);
drawLine(cubeSegment.vertices[2],cubeSegment.vertices[6],0xFF0000);
drawLine(cubeSegment.vertices[3],cubeSegment.vertices[7],0xFF0000);
drawLine(cubeSegment.vertices[3],cubeSegment.vertices[2],0xFF0000);
drawLine(cubeSegment.vertices[4],cubeSegment.vertices[5],0xFF0000);
drawLine(cubeSegment.vertices[4],cubeSegment.vertices[7],0xFF0000);
drawLine(cubeSegment.vertices[5],cubeSegment.vertices[6],0xFF0000);
drawLine(cubeSegment.vertices[6],cubeSegment.vertices[7],0xFF0000);
 
view.render();

}

//———-

function drawLine(start:Vertex,end:Vertex,color:Number = 0xFF0000):void {
var line:LineSegment = new LineSegment();
line.start = start;
line.end = end;
line.material = new WireframeMaterial(color);
scene.addChild(line);
}

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X