I d like not to use applyRotations method but i don't know how to do
without it !!!

On Jan 4, 7:13 pm, "Joshua Granick" <[email protected]> wrote:
> What does it do when you use applyRotations like this?
>
> Does it rotate everything as one object, or is it applying the same rotation 
> to each child object?
>
> Would it work to leave out applyRotations, and simple set the correct 
> rotation and then render?
>
> On Mon, 04 Jan 2010 10:02:14 -0800, Ghislain Flandin <[email protected]> 
> wrote:
> > Hello !!!
>
> > Thanks for your answer but i really really need to separate planes ...
> > I ve tried with a Cube primitive ... it works ... i d like to know if
> > there is an easy way to do that !!!
>
> > Thanks again for your help !!!
>
> > On Jan 4, 6:56 pm, "Joshua Granick" <[email protected]> wrote:
> >> Have you tried using away3d.primitives.Cube, or is there a reason why you 
> >> need to use seperate planes?
>
> >> On Mon, 04 Jan 2010 09:10:51 -0800, Ghislain Flandin <[email protected]> 
> >> wrote:
> >> > Hello guys ... Happy New Year ...
>
> >> > I'm trying to make a 6-planes-cube rotate but i have a problem ...
>
> >> > I used the applyRotations method on the container but the result is
> >> > not good ...
>
> >> > Maybe you can help me ...
>
> >> > Here is the 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.geom.Mirror;
> >> >    import away3d.materials.ColorMaterial;
> >> >    import away3d.materials.utils.SimpleShadow;
> >> >    import away3d.primitives.Cube;
> >> >    import away3d.primitives.Plane;
> >> >    import away3d.primitives.ReflectivePlane;
> >> >    import away3d.primitives.Sphere;
> >> >    import flash.display.Bitmap;
> >> >    import flash.display.BitmapData;
> >> >    import flash.display.BlendMode;
> >> >    import flash.display.Sprite;
> >> >    import flash.display.StageAlign;
> >> >    import flash.display.StageScaleMode;
> >> >    import flash.events.Event;
> >> >    import flash.events.KeyboardEvent;
> >> >    import flash.filters.BitmapFilterQuality;
> >> >    import flash.filters.BlurFilter;
> >> >    import flash.geom.Matrix;
> >> >    import flash.geom.Rectangle;
> >> >    import flash.text.TextField;
> >> >    import gs.TweenMax;
>
> >> >    public class Main extends View3D
> >> >    {
> >> >            private var container:ObjectContainer3D;
> >> >            private var planes:Array;
>
> >> >            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);
>
> >> >                    //stage setup
> >> >                    stage.scaleMode = StageScaleMode.NO_SCALE;
> >> >                    stage.align = StageAlign.TOP_LEFT;
>
> >> >                    //position setup
> >> >                    x = this.stage.stageWidth / 2;
> >> >                    y = this.stage.stageHeight / 2;
>
> >> >                    //camera setup
> >> >                    camera.x = 300;
> >> >                    camera.z = -900;
> >> >                    camera.y = 100;
>
> >> >                    //planes'array
> >> >                    planes = new Array();
>
> >> >                    //containers instances
> >> >                    container = new ObjectContainer3D();
> >> >                    for (var i:int = 0; i < 6; i+=1)
> >> >                            {
> >> >                            var col:uint = Math.random() * 0xFFFFFF;
> >> >                            var mat:ColorMaterial = new 
> >> > ColorMaterial(col);
> >> >                            var p:Plane = new Plane({ width:100, 
> >> > height:100, material:mat,
> >> > segmentsW:8, segmentsH:8,bothsides:true } );
>
> >> >                            if (i == 0)
> >> >                                    {
> >> >                                    p.z = -50;
> >> >                                    p.rotationX = 90;
> >> >                                    }
> >> >                            if (i == 1)     p.y = 50;
> >> >                            if (i == 2)
> >> >                                    {
> >> >                                    p.z = 50;
> >> >                                    p.rotationX = 90;
> >> >                                    }
> >> >                            if (i == 3) p.y = -50;
> >> >                            if (i == 4)
> >> >                                    {
> >> >                                    p.x = 50;
> >> >                                    p.rotationX = 90;
> >> >                                    p.rotationY = 90;
> >> >                                    }
> >> >                            if (i == 5)
> >> >                                    {
> >> >                                    p.x = -50;
> >> >                                    p.rotationX = 90;
> >> >                                    p.rotationY = 90;
> >> >                                    }
> >> >                            container.addChild(p);
> >> >                            planes.push(p);
> >> >                            }
> >> >                    //scene feed
> >> >                    scene.addChild(container);
>
> >> >                    camera.lookAt(new Number3D());
>
> >> >                    //handlers
> >> >                    addEventListener(Event.ENTER_FRAME, enterFrame, 
> >> > false, 0, true);
> >> >                    stage.addEventListener(KeyboardEvent.KEY_UP, 
> >> > onPressKey, false, 0,
> >> > true);
> >> >            }
>
> >> >            private function onPressKey(e:KeyboardEvent):void
> >> >                    {
> >> >                    switch(e.keyCode)
> >> >                            {
> >> >                            case 37: //left
> >> >                                    TweenMax.to(container, 0.3, { 
> >> > rotationY:"-90",
> >> > onComplete:rotationComplete,onCompleteParams:["y",-90],
> >> > overwrite:false } );
>
> >> >                                    break;
>
> >> >                            case 39: //right
> >> >                                    TweenMax.to(container, 0.3, { 
> >> > rotationY:"90",
> >> > onComplete:rotationComplete,onCompleteParams:["y",90],
> >> > overwrite:false } );
> >> >                                    break;
>
> >> >                            case 38: //up
> >> >                                    TweenMax.to(container, 0.3, { 
> >> > rotationX:"-90",
> >> > onComplete:rotationComplete,onCompleteParams:["x",-90],
> >> > overwrite:false } );
> >> >                                    break;
>
> >> >                            case 40: //down
> >> >                                    TweenMax.to(container, 0.3, { 
> >> > rotationX:"90",
> >> > onComplete:rotationComplete,onCompleteParams:["x",90],
> >> > overwrite:false } );
> >> >                                    break;
> >> >                            }
> >> >                    }
> >> >            private function 
> >> > rotationComplete(rotation:String,angle:Number):void
> >> >                    {
> >> >                    container.applyRotations();
> >> >                    }
> >> >            private function enterFrame(e:Event):void
> >> >                    {
> >> >                    var diffX:Number = (this.stage.mouseX - Math.round
> >> > (this.stage.stageWidth / 2)) / Math.round(this.stage.stageWidth / 2);
> >> >                    var diffY:Number = (this.stage.mouseY - Math.round
> >> > (this.stage.stageHeight/ 2)) / Math.round(this.stage.stageHeight / 2);
> >> >                    render();
> >> >                    }
> >> >    }
> >> > }
>
> >> > the link :http://pastebin.com/m54e44c4a
>
> >> > Thanks for your help !!!
>
> >> > Ghislain
>
>

Reply via email to