Hey Kanaeda

this should be fixed in the trunk, please update and let us know if it
worked for you!

atb

Rob

On Sun, Feb 15, 2009 at 9:21 PM, Kanaeda <[email protected]> wrote:

>
> I started learning how to use away3D today and I made like a simple
> example of two views rendering the same scene, with a cone, sphere and
> cube rotating around. The one scene using a normal Camera3D and the
> other using a TargetCamera3D... Everything was cool until I put
> PhongColorMaterials onto the objects... Funky things started
> happening, for some reason all the objects took on the same material
> at once, only one camera worked at a time... The depth of the objects
> went outta whack... Is there something I didn't do right or something?
> Heres the code:
>
> package {
>
>        import away3d.containers.Scene3D;
>        import away3d.containers.View3D;
>
>        import away3d.lights.DirectionalLight3D;
>        import away3d.materials.PhongColorMaterial;
>
>        import away3d.containers.ObjectContainer3D;
>
>        import away3d.primitives.Sphere;
>        import away3d.primitives.Cube;
>        import away3d.primitives.Cone;
>
>        import away3d.cameras.Camera3D;
>        import away3d.cameras.TargetCamera3D;
>
>        import away3d.core.math.Number3D;
>        import away3d.core.clip.RectangleClipping;
>        import away3d.core.base.Object3D;
>
>        import away3d.events.MouseEvent3D;
>
>        import flash.display.Sprite;
>        import flash.events.Event;
>
>        public class class3 extends Sprite {
>
>        var myScene:Scene3D;
>        var myObjects:ObjectContainer3D;
>
>        var myBox:Cube;
>        var mySphere:Sphere;
>        var myCone:Cone;
>
>        var myView1:View3D;
>        var myView2:View3D;
>
>        var myCamera1:Camera3D;
>        var myCamera2:TargetCamera3D;
>
>        var myLight1:DirectionalLight3D;
>
>        var mat1:PhongColorMaterial = new PhongColorMaterial(0xFFFF00);
>                var mat2:PhongColorMaterial = new
> PhongColorMaterial(0xFF0000);
>                var mat3:PhongColorMaterial = new
> PhongColorMaterial(0x0000FF);
>
>        public function class3() {
>                myScene = new Scene3D();
>                //myScene.autoUpdate = false;
>
>
>                myObjects = new ObjectContainer3D();
>                myScene.addChild(myObjects);
>
>                makeObjects();
>                makeViews();
>                makeLights();
>
>                addEventListener(Event.ENTER_FRAME, renderScene);
>        }
>        function makeObjects():void {
>
>
>                myBox = new Cube({material:mat1, width:10, height:40, depth:
> 10,x:-50});
>                mySphere = new Sphere({material:mat2, radius:20});
>                myCone = new Cone({material:mat3, radius:20,
> height:20,x:50});
>
>                myObjects.addChild(myBox);
>                myObjects.addChild(mySphere);
>                myObjects.addChild(myCone);
>
>                myBox.addEventListener(MouseEvent3D.MOUSE_DOWN,
> focusOnObject);
>                mySphere.addEventListener(MouseEvent3D.MOUSE_DOWN,
> focusOnObject);
>                myCone.addEventListener(MouseEvent3D.MOUSE_DOWN,
> focusOnObject);
>        }
>
>        function makeViews():void {
>                myCamera1 = new Camera3D({zoom:10,focus:100});
>                myCamera1.z = -150;
>                myCamera1.y = 250;
>                myCamera1.lookAt(new Number3D(0,0,0));
>                myView1 = new
> View3D({x:200,y:200,scene:myScene,camera:myCamera1});
>                myView1.clipping = new RectangleClipping({minX:-200,
> minY:-200, maxX:
> 200, maxY:200})
>
>                addChild(myView1);
>
>                myCamera2 = new TargetCamera3D({zoom:10,focus:100});
>                myCamera2.z = -250;
>                myCamera2.target = mySphere;
>                myView2 = new
> View3D({x:600,y:200,scene:myScene,camera:myCamera2});
>                myView2.clipping = new RectangleClipping({minX:-200,
> minY:-200, maxX:
> 200, maxY:200})
>                addChild(myView2);
>        }
>        function makeLights():void {
>                myLight1 = new DirectionalLight3D();
>                myScene.addChild(myLight1);
>                myLight1.x = 100;
>                myLight1.y = 80;
>                myLight1.z = -100;
>        }
>
>        function renderScene(e:Event):void {
>                myObjects.rotationY += 0.5;
>
>                //myScene.update();
>                myView1.render();
>                myView2.render();
>        }
>
>        function focusOnObject(e:MouseEvent3D):void {
>                var obj:Object3D = e.currentTarget as Object3D;
>                myCamera1.lookAt(new Number3D(obj.x,obj.y,obj.z));
>                myCamera2.target = obj;
>        }
>
>        }
> }




-- 
Rob Bateman
Flash Development & Consultancy

[email protected]
www.infiniteturtles.co.uk
www.away3d.com

Reply via email to