I don't think clipping will be a problem from the limited tests I have done, but poly's certainly are - so I will be keeping these to an absolute minimum, and so will not be increasing the resolution I would think.
I'm struggling with the lathe class, setting it to something other than 1 resulted in other shapes than a cube. I also think that I will still need to then alter the lathe mesh to say delete the bottom (hidden) face. So I think it will probably be best to just create my own coded primitives, giving most control over them. I just successfully built a cube, but yet to add the uv's. Drawing it out really helped here! Is this the correct way of doing this? obviously the values will be variables later on. thanks. ///Create Vertices var v0:Vertex = new Vertex(-50,-50,-50); ....... ....... var v7:Vertex = new Vertex(-50,50,50); //Create Faces var f0:Face = new Face(v1, v0, v2); //bottom var f1:Face = new Face(v3,v2,v0); //bottom ........ ........ var f10:Face = new Face(v1,v2,v6); //right var f11:Face = new Face(v6,v5,v1); //right // Create mesh: m0 = new Mesh(); m0.addFace(f0); ....... ....... m0.addFace(f11); On Nov 25, 4:29 pm, Fabrice3D <[email protected]> wrote: > the lathe class gives you control of the resolution like the cube > primitive > but doing by hand would not help for the resolution. in this case it > is set to 4. try pass 1... > so indeed building a dedicated primitive would be another option. > > I would not extend cube here so... I simply would make new class > in case your of course want resolution on top as well. but in this > case, you end up with same result as with Lathe. > > actually, if you have lots of these, the lower poly you use to display > one is better > but if for some clipping reasons or if the map needs to be blowed up, > you better off having slightly more resolution. > so having this option is a great help to find a balance once your > scenery is known/builded. > > Fabrice > > On Nov 25, 2009, at 3:59 PM, davivid wrote: > > > sweet, hadn't seen the lathe class - that will come in handy, thanks > > fabrice! However it seems to generate a lot more vertices than are > > needed(48 compared to 9), some with many decimal places - that will > > cause a little performance hit no? > > > Ideally like you suggest Jensa I will need to make a class to generate > > these objects. I will be dynamically generating a LOT of these, > > amongst some others. Initially passing in some simple > > parameters...width,h,d,pointheight,mat,x,y etc. Any tips would be > > welcomed! would I go about extending the cube class, and performing > > some sort of operation like I did above? > > > On Nov 25, 1:56 pm, Fabrice3D <[email protected]> wrote: > >> Well done! That's one way to do it, say the hard way. > >> So now, you know how to freak around with faces! > > >> Now let me piss you off a bit with the other (easy) way I did'nt > >> mention in previous mail. > >> To do this particular shape, simply use the Lathe class like this: > > >> var easyway:Lathe = new Lathe([new Number3D(0,-100,0),new > >> Number3D(-100,-100,0) new Number3D(-100,100,0), new > >> Number3D(0,100,0)], {flip:true, recenter:false, subdivision:4, > >> material:mat}); > > >> done! :)) > > >> Fabrice > > >> On Nov 25, 2009, at 1:33 PM, davivid wrote: > > >>> cheers Fabrice, > > >>> just what I needed to get me going. I've got it working, and seems > >>> to > >>> be fine - although im quite sure my method of trial and error is not > >>> the best way... Once I found the top faces, I noted them, and > >>> deleted > >>> them. I then created the new 4 faces based on the old two, and went > >>> through each of the new faces changing the vertices until everything > >>> lined up. Next I cycled through the vertices of the cube, and > >>> slotted > >>> these into my new faces where they matched. > > >>> I'm now wondering if there is likely to be any issues with the way I > >>> have done it? as Im after as much performance as possible. Or is > >>> there > >>> a better way of doing this? thanks. > > >>> pointedCube = new Cube( { width:200, height:200, depth:200 } ); > >>> view.scene.addChild(pointedCube); > > >>> pointedCube.removeFace(pointedCube.faces[8]); > >>> pointedCube.removeFace(pointedCube.faces[8]); //originally face 9 > > >>> var pointheight:Vertex = new Vertex(0, pointedCube.height, 0); // > >>> Vertex for Point > > >>> var one:Face = new Face(pointedCube.vertices[2], > >>> pointedCube.vertices > >>> [6], pointheight,new ColorMaterial(0xff0000)); > >>> var two:Face = new Face(pointedCube.vertices[0], pointheight, > >>> pointedCube.vertices[5],new ColorMaterial(0x00ff00)); > >>> var three:Face = new Face(pointedCube.vertices[2], pointheight, > >>> pointedCube.vertices[0],new ColorMaterial(0x0000ff)); > >>> var four:Face = new Face(pointheight, pointedCube.vertices[6], > >>> pointedCube.vertices[5],new ColorMaterial(0xccff00)); > > >>> pointedCube.addFace(one); > >>> pointedCube.addFace(two); > >>> pointedCube.addFace(three); > >>> pointedCube.addFace(four); > > >>> On Nov 25, 11:30 am, Fabrice3D <[email protected]> wrote: > >>>> sure, just insolate the two faces on top > >>>> note the four vertexes, delete the faces > >>>> and add four new faces. > > >>>> Fabrice > > >>>> On Nov 25, 2009, at 11:18 AM, davivid wrote: > > >>>>> Is it possible to modify the cube primitive in such a way that an > >>>>> extra vertex is added to the centre of say the top the face, and > >>>>> moved > >>>>> up to created a pointed/pyramid effect? > > >>>>> like this: > >>>>>http://away3d-dev.googlegroups.com/web/pointedcube.jpg > > >>>>> thanks.
