dunno what you want to achieved exactly, but if you want all triangles to be independant, you can do this in 3 or 4 lines of code...
step 1: var p:Plane = new Plane step2: Explode(p, boolean as unique mesh); done :) nice to note here, that it works on any Mesh object, not just planes... Fabrice On Jan 17, 2010, at 4:46 AM, jimalliban wrote: > Hi All > > I'm trying to make a grid of triangles to produce a plane that can be > broken apart for an Augmented reality project. Each triangle needs to > be double sided, but setting bothsides to true results in 2 triangles. > One is the proper triangle in the correct place with the UV mapping. > The other has all the default properties - 0, 0, 0, random > ColorMaterial, 100 * 100 etc etc. Have a look at this image to see > what I mean > > http://augmatic.co.uk/store/triangles.png > > It's not finished yet but here is the method: > > > private function buildTriangleGrid():void > { > _triangles = new Vector.<Triangle>(); > > var camelBmd:Camels = new Camels(0, 0); > var camelMat:BitmapMaterial = new > BitmapMaterial(camelBmd); > > var gridWidth:int = _segW * _triangleSize; > var griHeight:int = _segH * _triangleSize; > > var a:Vertex; > var b:Vertex; > var c:Vertex; > var d:Vertex; > > var uva:UV; > var uvb:UV; > var uvc:UV; > var uvd:UV; > > var i:int; > var j:int; > for (i = _segH; i > 0; i--) > { > > for (j = 0; j < _segW * 2; j++) > { > var triangle:Triangle = new Triangle(); > triangle.bothsides = true; > > if (j % 2 == 0) > { > /* > 0 __ 1 > \ | > \ | > \ | > \2 > */ > > var halfJ:int = j * 0.5; > > triangle.vertices[0] = new > Vertex(halfJ * _triangleSize - > (gridWidth * 0.5), > > i * _triangleSize, > > 0); > triangle.vertices[1] = new > Vertex((halfJ + 1) * _triangleSize - > (gridWidth * 0.5), > > i * _triangleSize, > > 0); > triangle.vertices[2] = new > Vertex((halfJ + 1) * _triangleSize - > (gridWidth * 0.5), > > (i - 1) * _triangleSize, > > 0); > > a = triangle.vertices[0]; > b = > triangle.vertices[1]; > c = triangle.vertices[2]; > d = new Vertex(0, (i - 1) * > _triangleSize, 0); > > uva = new UV(0, 1); > uvb = new UV(1, 1); > uvc = new UV(1, 0); > uvd = new UV(0, 0); > } > else > { > > /* > 0 > | \ > | \ > | \ > 1 ____2 > */ > > } > triangle.addFace(new Face(a, b, c, > camelMat, uva, uvb, uvc)); > _triangles.push(triangle); > addChild(triangle); > } > } > } > > > Hope someone can help > > Cheers > > Jim > >
