Hi Pete !!!
Thanks again for your help ...but it doesn't work !!
Here is my code :
package
{
import away3d.containers.ObjectContainer3D;
import away3d.containers.View3D;
import away3d.core.base.Vertex;
import away3d.core.math.Number3D;
import away3d.geom.Explode;
import away3d.primitives.Plane;
import away3d.primitives.Sphere;
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author Ghislain Flandin
*/
public class Main extends View3D
{
private var exploded:ObjectContainer3D;
private var nbVertices:int;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE,init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
x = this.stage.stageWidth / 2;
y = this.stage.stageHeight / 2;
camera.z = -900;
camera.y = 0;
var plane:Plane = new Plane( { width:256, height:91,
segmentsW:8,
segmentsH:7 ,rotationX:90} );
//scene.addChild(plane);
var exploder:Explode = new Explode(true,true);
exploded = exploder.apply(plane) as ObjectContainer3D;
var containerExploded:ObjectContainer3D = new
ObjectContainer3D();
scene.addChild(containerExploded);
containerExploded.addChild(exploded);
//containerExploded.rotationX = 90;
//use a sphere to position my triangles
var sphere:Sphere = new Sphere( {segmentsW:11,
segmentsH:11,
radius: 200} );
//scene.addChild(sphere);
nbVertices = sphere.vertices.length;
for (var i:int = 0; i < sphere.vertices.length; i+=1)
{
var vertex:Vertex = sphere.vertices[i];
exploded.children[i].x = sphere.vertices[i].x;
exploded.children[i].bothsides = true;
exploded.children[i].y = sphere.vertices[i].y;
exploded.children[i].z = sphere.vertices[i].z;
//exploded.children[i].rotationX = 90;
exploded.children[i].lookAt(new Number3D());
}
//addEventListener(Event.ENTER_FRAME, enterFrame,
false, 0, true);
render();
}
private function enterFrame(e:Event):void
{
render();
}
}
}
Thanks again !!!
On 10 déc, 21:59, Peter Kapelyan <[email protected]> wrote:
> Hi Ghislain,
>
> Try this:
>
> exploded.children[i].rotationX+=90;
>
> after
>
> exploded.children[i].lookAt(new Number3D());
>
> It should be correct for you.
>
> lookAt works fine, it's just that by default, it depends what orientation
> your object is in, for it to face the way it is.
>
> -Pete
>
> On Thu, Dec 10, 2009 at 3:47 PM, Ghislain Flandin <[email protected]>wrote:
>
>
>
> > Hello ...
>
> > sorry for my double post but it i thought that the topic was
> > different !
>
> > In fact, i want to have the same distribution and triangle
> > orientation ... i don't want to do interact like on the link ... i
> > only want to put my triangles like this example ...
>
> > unfortunately, i didn't manage to do it with away3D .... the lookAt
> > method doesn't seem to work as on pv3D
>
> > Thanks again
>
> > Ghislain
>
> > On 10 déc, 21:22, Peter Kapelyan <[email protected]> wrote:
> > > Hi Ghislain,
>
> > > Sometimes messages don't get answered fast, or not at all on this list.
> > But
> > > that doesn't mean they get lost, I think people will answer if they can.
>
> > > Why can't you do the same thing as in the link you posted, if that is
> > what
> > > you would like to do? Is it too much code for you, or you don't know how
> > to
> > > do it in away3d?
>
> > > -Peter
>
> > > On Thu, Dec 10, 2009 at 3:17 PM, Ghislain Flandin <[email protected]
> > >wrote:
>
> > > > Here is a message from a previous message ...the subject is not the
> > > > same ...
>
> > > > I d'like to distribute triangles all around a sphere and i have an
> > > > orientation problem ...
>
> > > > Here is what i'd like to do :
> > > >http://forum.papervision3d.org/viewtopic.php?f=20&p=4989
>
> > > > Here is a short example of what i 've got :
>
> > > > package
> > > > {
> > > > import away3d.containers.ObjectContainer3D;
> > > > import away3d.containers.View3D;
> > > > import away3d.core.base.Vertex;
> > > > import away3d.core.math.Number3D;
> > > > import away3d.geom.Explode;
> > > > import away3d.primitives.Plane;
> > > > import away3d.primitives.Sphere;
> > > > import flash.display.Sprite;
> > > > import flash.events.Event;
>
> > > > /**
> > > > * ...
> > > > * @author Ghislain Flandin
> > > > */
> > > > public class Main extends View3D
> > > > {
>
> > > > public function Main():void
> > > > {
> > > > if (stage) init();
> > > > else addEventListener(Event.ADDED_TO_STAGE,
> > > > init);
> > > > }
>
> > > > private function init(e:Event = null):void
> > > > {
> > > > removeEventListener(Event.ADDED_TO_STAGE,
> > > > init);
>
> > > > x = this.stage.stageWidth / 2;
> > > > y = this.stage.stageHeight / 2;
>
> > > > camera.z = -900;
> > > > camera.y = 0;
>
> > > > var plane:Plane = new Plane( { width:256,
> > > > height:91, segmentsW:8,
> > > > segmentsH:7 ,rotationX:90} );
> > > > //scene.addChild(plane);
>
> > > > var exploder:Explode = new Explode(true,
> > > > true);
> > > > var exploded:ObjectContainer3D = exploder.apply
> > > > (plane) as
> > > > ObjectContainer3D;
>
> > > > var containerExploded:ObjectContainer3D = new
> > > > ObjectContainer3D();
> > > > scene.addChild(containerExploded);
> > > > containerExploded.addChild(exploded);
> > > > //containerExploded.rotationX = 90;
>
> > > > //use a sphere to position my triangles
> > > > var sphere:Sphere = new Sphere( {segmentsW:11,
> > > > segmentsH:11, radius:
> > > > 150} );
> > > > //scene.addChild(sphere);
>
> > > > for (var i:int = 0; i <
> > > > sphere.vertices.length; i+=1)
> > > > {
> > > > var vertex:Vertex = sphere.vertices
> > > > [i];
> > > > exploded.children[i].x =
> > > > sphere.vertices[i].x;
> > > > exploded.children[i].y =
> > > > sphere.vertices[i].y;
> > > > exploded.children[i].z =
> > > > sphere.vertices[i].z;
>
> > > > exploded.children[i].lookAt(new
> > > > Number3D());
> > > > }
>
> > > > render();
> > > > }
>
> > > > }
>
> > > > }
>
> > > > I hope you could help me !!!
>
> > > > Thanks a lot !
>
> > > > Ghislain
>
> > > --
> > > ___________________
>
> > > Actionscript 3.0 Flash 3D Graphics Engine
>
> > > HTTP://AWAY3D.COM
>
> --
> ___________________
>
> Actionscript 3.0 Flash 3D Graphics Engine
>
> HTTP://AWAY3D.COM