look at tools.Meshhelper class
there is also a function that build one for you from your vectors
Note that I add new helpers methods/classes dayly in there, and some are
subject to change as well.
Fabrice
On Mar 3, 2011, at 11:05 PM, Daniel Reitterer wrote:
> hi
>
> can somebody help me with the Mesh and Face creation? i ve looked into
> the new SubMesh and SubGeometry classes
> but haven't figured out how this works
>
> for version 3.6 i have used a function like this
>
> // create away3d 3.6 object
> function createAwayObject ( name:String, obj:Editor3DObject )
> {
> var mesh:Mesh = new Mesh();
> var v1:Vertex;
> var v2:Vertex;
> var v3:Vertex;
> var u1:UV;
> var u2:UV;
> var u3:UV;
>
> for each( poly in obj.polygons )
> {
> v1 = new Vertex( poly.point1.x, poly.point1.y, poly.point1.z);
> v2 = new Vertex( poly.point2.x, poly.point2.y, poly.point2.z);
> v3 = new Vertex( poly.point3.x, poly.point3.y, poly.point3.z);
>
> u1 = new UV(poly.u1, 1-poly.v1);
> u2 = new UV(poly.u2, 1-poly.v2);
> u3 = new UV(poly.u3, 1-poly.v3);
>
> mesh.geometry.addFace( new Face(v1,v2,v3,
> materials[poly.matName] ,u1,u2,u3) );
> }
> assignTransform( mesh, obj );
> mesh.updateMesh( view );
>
> return mesh;
> }
>
> thx