Thank you everyone for all of the suggestions and thanks Rob, i think your way sounds like the way to go. I will mess around with it and see where i get.
Last night i was figuring out how to draw lines in Away3D and never could get Line2D to work, not without seeing some examples on how to use it at least, BUT i did managed to get LineSegment() to work, assign it a line thickness and color, and be able to add it to an ObjectContainer3D so i can display it. BUT as for a base object to draw lines on, I also got Sprite2D / Sprite3D to display on screen, BUT its problem was that it is designed to always face the camera and since i am using HoverCamera3D where the hex plane or stage can be made to tilt and also pan across the screen, that would not work for me. Besides, never figured creating a simple SPRITE object would be so complicated in Away3D as compared to Native Flash...lol... at least took a bit to figure out what worked without assigning the Sprite an Bitmap image. I was also hoping that an object similar to SHAPE() in Flash was possible in Away3D as the SHAPE is something lightweight to draw on but does not get bloated easily with extra stuff like MouseEvents or etc. Also, in Native Flash you can actually draw different shapes using either SPRITE or SHAPE and using drawPath and beingFIll/endFill for color SO there had to be a way to do something similar in Away3D. But, i think that FACE object in Away3D is just what i was looking for so again thanks for everyone and will give that a try first and see where i get. On May 4, 3:27 am, Rob Bateman <[email protected]> wrote: > Hey CyberHawk > > the best way to draw a hexagon in teh way you're desciubing is probably > using the drawing api on the face class. This is similar to the native > drawing api in flash, and just requires that you create a mesh object, and > add each face using something like: > > var hex:Face = new Face(); > hex.moveTo(p0X, p0Y, 0); > hex.lineTo(p1X, p1Y, 0); > hex.lineTo(p2X, p2Y, 0); > hex.lineTo(p3X, p3Y, 0); > hex.lineTo(p4X, p4Y, 0); > hex.lineTo(p5X, p5Y, 0); > hex.lineTo(p0X, p0Y, 0); > > mesh.addFace(hex) > > you can then apply materials to the face using the 'material' property, and > react to mouse events in the usual way etc > > Rob > > > > On Tue, May 4, 2010 at 7:42 AM, Peter Kapelyan <[email protected]> wrote: > > You can also have a sort of dynamic or LOD material, or just a high-res > > low-res version (high res shows if you are super close, and concerned with > > it looking crappy). So Plane + png or bitmap will be your fastest, best bet. > > Next best bet might be just to outline each shape with vector lines, but > > you'll have to find a way to fill that shape, and it most likely won't be > > as fast as what I said earlier. > > > -Pete > > > On Mon, May 3, 2010 at 5:21 PM, Reinorvak <[email protected]>wrote: > > >> You can use the Plane method if you're clever about it. Depends on how > >> you use your picking. Just from using 3D experience though, Less faces > >> is usually the better option so I'd vote towards Line2D or Sprite. > > >> As for zooming in and out, I've seen little effect on PNGs really > >> unless you get really really really close to these models/images/etc. > >> If you can make the texture repeatable, you could do it simply with > >> one giant plane, and repeat the texture across it till you're > >> satisfied, unless it needs to be more dynamic then that. You'd have a > >> square map, with a hexagonal field. > > >> On May 3, 5:12 pm, CyberHawk <[email protected]> wrote: > >> > Well, i don't what to use a PLANE as that means my grid has to be > >> > square in shape. I need/would like to create a hexagon shaped grid. I > >> > have thought about just creating a PNG image of a hexagon with a > >> > partial transparent background and a certain color outline in like > >> > Photoshop or similar, BUT that means if i later change something, i > >> > have to recreate it ever time. Not saying it is hard or anything, but > >> > it makes it less dynamically generated. If that is the ONLY way to do > >> > it, i definitely will have to do it that way as this issue is holding > >> > back my project, but i was hoping to find a way to draw the hexagons > >> > instead of creating a PNG. It is not an absolute requirement to be > >> > partially transparent, it could be completely transparent, but i did > >> > not try that yet as i wasn't sure how the PNG would look like once you > >> > zoom in and out on the grid, as in if it will distort the image or > >> > not. > > >> > On May 3, 4:59 pm, Peter Kapelyan <[email protected]> wrote: > > >> > > Why not just use a plane (two polys) with a MovieClip or regular > >> bitmap > >> > > (png?). The mouse *should detect the parts that are transparent as > >> > > unclickable, so you can have hundreds of those, quite possibly. > > >> > > -Pete > > >> > > On Mon, May 3, 2010 at 4:35 PM, CyberHawk <[email protected]> > >> wrote: > >> > > > I have such a simple problem/issue/question that i can't seem to > >> find > >> > > > quite the answer to without asking. So, I am using Away3D 3.5 > >> (Latest > >> > > > as of this question 5-3-10) and for starters all i am trying to do > >> is > >> > > > create a hexagonal shaped grid using smaller hexagons. The MAIN > >> > > > purpose for this larger hexagon grid is so you can drag other 3D > >> > > > objects to it from a list later on and the grid accepts mouse clicks > >> > > > so you can select the hexagons. > > >> ----------------------------------------------------------------------------------------------- > >> > > > I am creating one hexagon shape (Side=6) using the object type > >> > > > "RegularPolygon", Radius=57, and i am using that as a BASE since i > >> > > > want to set a color to it, an “alpha= 0.3, ownCanva=true”, to make > >> it > >> > > > partially transparent so the background show's thru and i need to > >> > > > create this base object so i can have something solid so i can click > >> > > > on using the “MouseEvent3D” event. > > >> > > > Next i create a second hexagon shape (Side=6) using the object type > >> > > > "WireRegularPolygon", Radius=57 to form an outline to the first > >> "BASE" > >> > > > hexagon so you can see the hexagon object AND its main purpose is > >> once > >> > > > you click on the base hexagon, it will change the wire hexagons > >> color > >> > > > to something else, showing that that hexagon was selected. > > >> > > > I use a FOR LOOP to generate a larger Hexagon shape using the above > >> > > > two objects, which is made up of a total of 542 RegularPolygon’s and > >> > > > 542 WireRegularPolygon’s but would like twice that much or more > >> later > >> > > > on. > > >> > > > The reason I would rather generate the grid dynamically is so I can > >> > > > create different size hexagons or different patterns of them later > >> on. > >> > > > If I used a hexagon image, I would have to recreate it if I changed > >> > > > its size or color. > > >> ----------------------------------------------------------------------------------------------- > >> > > > MY PROBLEM is that once I make that grid zoomed out all the way so > >> you > >> > > > can see the entire thing, the "T ELEMENT=3252" and the "R ELEMENT > >> > > > ranges from 3405 to 3795" depending on how the HoweverCamera3D is > >> > > > tilted. The RAM is around 50MB to 60MB which does not seem too bad > >> for > >> > > > now. The FPS at max zoom is around 8 to 10 FPS when you rotate and > >> > > > till the camera. It is also using FP10 and all coding is done in > >> Adobe > >> > > > CS4 Suite. I am also using BASIC RENDERING. All hexagons are > >> generated > >> > > > in a separate AS3 class file which extends ObjectContainer3D and I > >> > > > create an instance of this class in the MAIN AS3 class file. I have > >> > > > nothing else on screen but the large hex grid and a static 500x500 > >> JPG > >> > > > image as the background. > > >> > > > ALL I am looking to do is make a very lightweight hexagon grid using > >> > > > ANY 3D Object type that can accept a MouseEvent3D event so I can > >> click > >> > > > on it, be able to have alpha set (BUT I could do away with that and > >> > > > make it be 100% transparent), and have an outline that I can later > >> > > > change its color and thickness to show it was clicked on as this > >> > > > object serves nothing more than a sort of "stage" for other objects. > >> > > > Basically, in my view, that hexagon “stage” is suppose to be the > >> LEAST > >> > > > performance hungry of all other objects to come. > > >> ----------------------------------------------------------------------------------------------- > >> > > > In my first attempt before I started using away3D, i just created > >> each > >> > > > Hexagon "BASE" using a Sprite object and generating the "OUTLINE" > >> > > > using a Shape object that you can draw on using the graphics and > >> > > > drawPath functions and had to actually draw the hexagon shape > >> manually > >> > > > using lines and sin/cos. > > >> > > > MY next set of questions would be about if there is a "drawPath()" > >> > > > function in away3d just like in Flash to draw on sprites and Shape > >> > > > objects. I did see it, BUT really don't know if it works like the > >> one > >> > > > in Flash. I also did see a Graphics3D.as file that seems to have > >> > > > similar functions such as "moveTo" and etc, but i have not seen any > >> > > > examples on how to use it yet. > > >> > > > When i just display the outline hexagon SHAPE objects in Flash, i > >> can > >> > > > create a huge grid, over 1000 objects, and it runs really fast > >> > > > (meaning can rotate it using rotationY as well as panning without > >> loss > >> > > > of FPS). But it is not practical to try to click on a wire frame > >> > > > outline of a hex. Don't know the poly count or RAM usage as that is > >> > > > created using the native Flash Display objects AND I can't add > >> sprite > >> > > > or shape objects into any Away3D objects directly, so can't display > >> > > > them. I have tried and could not figure it out yet BUT if there is a > >> > > > way that might help a lot as i know those Flash objects being > >> > > > displayed are much faster on the FPS. > > >> ----------------------------------------------------------------------------------------------- > >> > > > I am by no means an expert at away3D or Flash and I started using > >> > > > Away3D like a month ago and I have to admit it is incredibly awesome > >> > > > 3D package. I have not yet explored using Line2D or Line3D to draw > >> > > > the hexagons manually as well as Sprite3D objects for the BASE mouse > >> > > > event object in away3D but those will be my next things to > >> experiment > >> > > > with, BUT before I just jump head first into recreating the entire > >> > > > thing 5 different ways, I would like to know an easy way to generate > >> a > >> > > > very simple hexagon grid that you can select each smaller hexagons > >> it > >> > > > is made of, without making the POLY COUNT so enormously large. There > >> > > > are many ideas as t how to do it, BUT I would rather try using basic > >> > > > primitive objects available in away3D or something simple with the > >> > > > least amount of code to try to optimize it. > > >> > > > Thanks for anyone who can answer my question. > > >> > > -- > >> > > ___________________ > > >> > > Actionscript 3.0 Flash 3D Graphics Engine > > >> > > HTTP://AWAY3D.COM > > > -- > > ___________________ > > > Actionscript 3.0 Flash 3D Graphics Engine > > > HTTP://AWAY3D.COM > > -- > Rob ... > > read more »
