Create mesh dinamically

Software: Away3D 4.x

marziac, Newbie
Posted: 27 June 2011 01:49 PM   Total Posts: 4

Hello,
I’m trying to create a mesh dynamically. Basically it is a wall with a window (a hole) inside. It’s easy to create multiple cubes together but it’s not ok when I apply the material. The texture is not well placed. In 3.6 could be created easily by drawing faces with moveTo and lineTo. How I can do this with Broomstick?

Thank you.

   

Stephen Hopkins, Sr. Member
Posted: 27 June 2011 09:37 PM   Total Posts: 110   [ # 1 ]

create a Vector.<Number> for vertices (3 numbers per vertex), and a Vector.<uint> for vertex indices.

It helps to draw what kind of primitive you are trying to make. Number all of your vertices, then pick your indices to make triangles. After you have a vector of vertices and indices,

http://en.wikipedia.org/wiki/Polygon_mesh#Face-vertex_meshes
think of the face list as the vertex indice list, the vertex list contains the vertex positions.

var window:Mesh = new Mesh();
var sub:SubGeometry = new SubGeometry();
sub.updateIndexData(indexData);
sub.updateVertexData(vertexData);
window.geometry.addSubGeometry(sub);

There might a better way to do it, I don’t know the engine well enough, but this method works for me. There’s also an updateUVData(..) if you want to use textures, finding the uv coordinates might be a little more difficult

 Signature 

http://www-scf.usc.edu/~shopkins

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X