Hello,
I’m using away3d 3.6 and try to create a simply polygon with a texture. It’s an simply 2D-square with 8 3D-points and a hole inside. I can’t use the plane primitive or something else because I also have to create planes with rounded corners.
I’ve created a mesh and added a Face with 8 points (with moveTo and lineTo). When I use the WireColorMaterial as material, it looks fine. I see my square with the specified line and fill color. The hole in the square is also ok.
Then I used the BitmapMaterial as material. I have set the uv0, uv1 and uv2 coordinates of the face. But I just see the top-left triangle of my square with the selected bitmap. How can I draw a custom polygon(or Face) and put a texture on it? I tried to use RegularPolygon but it does not work for me because I have random connected points and have to put a texture on it. I have uploaded a screenshot and the code is below. Thanks for help!
var away3DMaterial:BitmapMaterial = new BitmapMaterial(Cast.bitmap(away3DBitmap), {smooth:true, precision:2});
var lineMaterial : WireColorMaterial= new WireColorMaterial();
lineMaterial.color = 0xFFFFFF;
lineMaterial.wireColor = 0x00FF00;
lineMaterial.thickness = 1;
var mesh : Mesh = new Mesh();
mesh.bothsides = true;
var polygon: Face = new Face();
polygon.material=away3DMaterial;
polygon.moveTo(-50,-50,0);
polygon.lineTo(-50,50,0);
polygon.lineTo(50,50,0);
polygon.lineTo(50,-50,0);
polygon.lineTo(-50,-50,0);
polygon.moveTo(-25,-25,0);
polygon.lineTo(-25,25,0);
polygon.lineTo(25,25,0);
polygon.lineTo(25,-25,0);
polygon.lineTo(-25,-25,0);
polygon.uv0=new UV(0,0);
polygon.uv1=new UV(0,1);
polygon.uv2=new UV(1,1);
mesh.addFace(polygon);
group.addChild(mesh);