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

Reply via email to