Hi Florent, I've just had a search through my code local archives and am unable to locate the dev tests from those links I gave you. You should however be able to SWF Decompile them and get the code that was used. But the quick test code I gave you earlier was along the lines of what was used.
D 2009/8/3 fdb <[email protected]> > > Thank you. I really appreciate. > > On Aug 3, 5:40 pm, Darcey Lloyd <[email protected]> wrote: > > I don't have the code on me at the moment Florent, I'm at work :( > > > > I re-create the object in triangles and then change their material > colour. > > > > But best i can remember is it was something along the lines of: > > > > * > > > > package* { > > > > *import* away3d.cameras.HoverCamera3D; > > > > *import* away3d.containers.Scene3D; > > > > *import* away3d.containers.View3D; > > > > *import* away3d.core.base.Face; > > > > *import* away3d.materials.ColorMaterial; > > > > *import* away3d.materials.WireframeMaterial; > > > > *import* away3d.primitives.Plane; > > > > *import* away3d.primitives.Triangle; > > > > *import* flash.display.MovieClip; > > > > *import* flash.events.Event; > > > > *public* *class* Away3DTest *extends* MovieClip > > > > { > > > > *private* *var* scene:Scene3D; > > > > *private* *var* camera:HoverCamera3D; > > > > *private* *var* view:View3D; > > > > *public* *function* Away3DTest() > > > > { > > > > scene = *new* Scene3D(); > > > > camera = *new* HoverCamera3D(); > > > > view = *new* View3D({scene:scene,camera:camera}); > > > > *// setup camera > > * > > > > camera.panangle = 0; > > > > camera.tiltangle = 0; > > > > camera.targetpanangle = camera.panangle = 0; > > > > camera.targettiltangle = camera.tiltangle = 0; > > > > camera.mintiltangle = -90; > > > > camera.maxtiltangle = 20; > > > > camera.zoom = 2; > > > > camera.focus = 125; > > > > camera.distance = 250; > > > > view.x = 400/2; > > > > view.y = 400/2; > > > > *// Create object > > * > > > > plane = *new* Plane(); > > > > plane.width = 300; > > > > plane.height = 300; > > > > plane.bothsides = *true*; > > > > plane.segmentsH = 2; > > > > plane.segmentsW = 2; > > > > *var* mat:WireframeMaterial = *new* WireframeMaterial(0x000000); > > > > plane.material = mat; > > > > view.scene.addChild(plane); > > > > *var* nTriangleCount:Number = 0; > > > > *for* *each* (*var* f:Face *in* plane.faces) > > > > { > > > > nTriangleCount++ > > > > *trace*(*"Triangle "* + nTriangleCount); > > > > *trace*(*"\t"* + *"Vertex point 1: "* + f.v0.toString()); > > > > *trace*(*"\t"* + *"Vertex point 2: "* + f.v1.toString()); > > > > *trace*(*"\t"* + *"Vertex point 3: "* + f.v2.toString()); > > > > *trace*(*""*); > > > > *var* m:ColorMaterial = *new* ColorMaterial((Math.random()*100000)); > > > > *var* t:Triangle = *new* Triangle(); > > > > t.bothsides = *true*; > > > > t.a = f.v0; > > > > t.b = f.v1; > > > > t.c = f.v2; > > > > view.scene.addChild(t); > > > > } > > > > *this*.addChild(view); > > > > *this*.addEventListener(Event.ENTER_FRAME,render); > > > > } > > > > *private* *var* plane:Plane; > > > > *// > > > -------------------------------------------------------------------------------------------- > > * > > > > *private* *function* render(e:Event):*void > > * > > > > { > > > > *// Camera mouse control > > * > > > > camera.targettiltangle = 80 - (stage.mouseY / 2); > > > > camera.targetpanangle = 100 - (stage.mouseX / 2); > > > > *//plane.rotationX += 2; > > * > > > > *//plane.rotationY += 2; > > * > > > > camera.hover(); > > > > view.render(); > > > > } > > > > *// > > > -------------------------------------------------------------------------------------------- > > * > > > > } > > > > } > > > > but the for each could have been > > > > *for* *each* (*var* v:Vertex *in* plane.vertices) > > > > *{* > > > > I will see if I still have the dev code back home and post later for you > if > > I do. > > > > D > > > > 2009/8/3 fdb <[email protected]> > > > > > > > > > Don't you want to share the as file on you swf ? Some code will be > > > appreciated. > > > > > I just want to know the code to put 2 differents colors on each > > > triangle of a Plane. > > > > > On Aug 3, 4:52 pm, Darcey Lloyd <[email protected]> wrote: > > > > Just remembered some more info, it was something along the lines of > for > > > each > > > > (var f:face in myplane) or for each (var v:vertex in > myplane.vertexes) > > > for > > > > the below tests that I created generating an array of triangles > within > > > with > > > > colourmaterial applied to each. > > > > > > Regarding the video example you showed, if your object it recreated > this > > > > way, on moue over can apply a new colourmaterial to the triangle. > > > > > > D > > > > > > 2009/8/3 Darcey Lloyd <[email protected]> > > > > > > > I experimented with maybe something you may find useful to what you > > > want to > > > > > do. > > > > > > >http://www.allforthecode.co.uk/development/away3d/on_dev/01.swf > > > > > which led to > > > > >http://www.allforthecode.co.uk/development/away3d/on_dev/04.swf > > > > > and > > > > >http://www.allforthecode.co.uk/development/away3d/on_dev/03.swf > > > > > > > I created an object, then using each 3 points of each triangle in > the > > > mesh > > > > > array of that object (i think it was) i looped through them all > > > creating > > > > > triangles and colouring them as i looped through. I don't have the > code > > > to > > > > > hand but that idea may help? > > > > > > > D > > > > > > > 2009/8/3 fdb <[email protected]> > > > > > > >> Yes like this. Do you want to share the tips ? > > > > > > >> On 3 août, 14:15, ben <[email protected]> wrote: > > > > >> > Hi, > > > > >> > you mean like this :http://www.vimeo.com/4526936( at 0:30 min) > > > > > > >> > I assume this is a self promotional answer ! > > > > >> > ;-) >
