Hi,
I want to create a more complex object(a house) straight out of triangles. I’ve been using facehelper and everything seemed al right until I tried to add lighting. Lighting sometimes works for some triangles and doesn’t work for others. I suspect it has something to do with either vertex normals or vertex tangents. I know they have to get auto generated and I checked the subgeometry and they are there.
here is the code I use to create the mesh:
var geometry:Geometry = new Geometry();
var material:MaterialBase = WallTypeLib.types[typeID].material;
material.repeat = true;
mesh = new Mesh(geometry, material);
//triangle 1:
var v0:Vertex = new Vertex(startPoint.x, startPoint.y, startPoint.z);
var v1:Vertex = new Vertex(startPoint.x, startPoint.y + height, startPoint.z);
var v2:Vertex = new Vertex(endPoint.x, endPoint.y, endPoint.z);
var uv0:UV = new UV(0, height);
var uv1:UV = new UV(0, 0);
var uv2:UV = new UV(length(), height);
FaceHelper.addFace(mesh, v0, v1, v2, uv0, uv1, uv2, 0);
On a related note, I noticed when looking in the subgeometry of the plane primitive that it has way more entries for the vertex data, vertex normals and vertex tangents. I am expecting 3 entries per vertex in the vertex data but the plane has about 52 for 4 vertices.
Thank you, any suggestion helps, I am quite stuck.