Accessing vertices
Let's go back for a moment to the basic elements of a 3D object—vertices. The vertices of every do3D are stored in an array. You can access them through the geometry property.
do3D.geometry.vertices
Suppose you would like to know the x and y coordinates of all the vertices of the plane that we built in PlaneExample. Because the vertices are stored in an array, you can find out how many there are by using the length property.
var numberOfVertices = plane.geometry.vertices.length;
Then you can iterate through the array using a for loop.
for(var i:uint = 0; i < numberOfVertices; i++)
{
trace("x: " + plane.geometry.vertices[i].x,
"y: " + plane.geometry.vertices[i].y,
"z: " + plane.geometry.vertices[i].z)
}
This will output:
x: -150 y: -150 z: 0
x: -150 y: 150 z: 0
x: 150 y: -150 z: 0
x: 150 y: 150 z: 0
As you can see, only the x, y, and z positions of four points are given. Maybe you would have expected the positions of six points because every triangle has three vertices...