Hi Steve,

Here is a snippet of some code I wrote to try to figure out the
vertex/uv/face/mesh relationships. It generates the simplest solid I could
think of: four vertices and four faces:

// Create vertices:
v0 = new Vertex(  0,  0,  0);
v1 = new Vertex(100,  0,  0);
v2 = new Vertex( 50, 50,100);
v3 = new Vertex( 50,-50,100);
// Create UVs:
uv0 = new UV(0.0,1.00);
uv1 = new UV(0.0,0.0);
uv2 = new UV(1,1);
uv3 = new UV(0.5,0.25);
uv4 = new UV(1.0,0.50);
uv5 = new UV(1.0,0.00);
// Create faces:
f0 = new Face(v1,v3,v2);
f0.uv0 = uv2;
f0.uv1 = uv3;
f0.uv2 = uv4;
f1 = new Face(v0,v2,v3);
f1.uv0 = uv5;
f1.uv1 = uv4;
f1.uv2 = uv3;
f2 = new Face(v0,v3,v1);
f2.uv0 = uv1;
f2.uv1 = uv3;
f2.uv2 = uv2;
f3 = new Face(v0,v1,v2);
f3.uv0 = uv1;
f3.uv1 = uv2;
f3.uv2 = uv0;
// Create mesh:
m0 = new Mesh();
m0.addFace(f0);
m0.addFace(f1);
m0.addFace(f2);
m0.addFace(f3);
m0.material = phongColorMat;

HTH!

David Z

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of steanson
Sent: Tuesday, July 28, 2009 11:02 AM
To: away3d.dev
Subject: [away3d] Re: generate object from 3d coords


thanks for the replies!

I was hoping that I could define some points/triangles and go from
there, is that not possible?
I don't really understand the way that triangles, faces, mesh and
materials are related. Are there some notes, as the docs don't make
the relationships explicit.

cheers Steve

On Jul 28, 2:47 pm, Peter Kapelyan <[email protected]> wrote:
> Use can use a Lathe extrusion to create your object. Once it is created
you
> can try to find the faces manually, and overwrite those sides with new
> materials. Let me know if it makes sense.
>
> -Pete
>
> On Tue, Jul 28, 2009 at 9:07 AM, steanson
<[email protected]>wrote:
>
>
>
> > For example is there a way to specify local coordinates for say a
> > pyramid, assign materials to each face?
>
> > On Jul 28, 9:16 am, steanson <[email protected]> wrote:
> > > If I know / can work out my coordinates in 3d space for an object,
> > > quite a simple one, what is the best way to create this in away3d. I'm
> > > trying to avoid learning a package like Blender.
>
> > > thanks Steve
>
> --
> ___________________
>
> Actionscript 3.0 Flash 3D Graphics Engine
>
> HTTP://AWAY3D.COM


Reply via email to