No sure what your trying to achieve, try using a plane and adjust your
camera focus and zoom. or use a large sphere at camera location, so the
camera is inside it and check camera movement settings.

D



On 30 January 2011 10:46, squ <[email protected]> wrote:

> ok, thanks
> here is the demo: http://prologis.win.pl/OverlayTest.swf
>
> I created a class called Overlay and placed it in away3D/overlays
> folder
>
> I place it on a standard away3D stage like this: overlay = new
> Overlay(view, camera);
> the original size of the document is 700x600px (this is important!)
>
> so, whatever you do for checking first make the window display:
> 700x600 (700 in width)
>
> the away3D scene has a resize function:
>
> private function Resize(evt:Event = null):void {
> view.x = this.stage.stageWidth / 2;
> view.y = this.stage.stageHeight / 2;
>
> clipping.minX = -this.stage.stageWidth/2;
> clipping.minY = -this.stage.stageHeight/2;
> clipping.maxX = this.stage.stageWidth/2;
> clipping.maxY = this.stage.stageHeight/2;
>
> var te = "stageWidth/stageHeight: " + this.stage.stageWidth + " / " +
> this.stage.stageHeight;
> _txt.text = te;
>
> EnterFrame();
> }
>
> the test swf you see when set at 700x600 make the square perspective
> to the scene, but when you resize and actually CHANGE the view.x/
> view.y something happens to the overlay object
> I checked everything: scale, size, x/y of everything - it is exactly
> the same before and after resizing but the square changes its look
>
> here is the Overlay class:
>
> package away3d.overlays
> {
>        import away3d.cameras.*;
>        import away3d.core.base.*;
>        import away3d.containers.View3D;
>        import away3d.cameras.Camera3D;
>
>
>        import flash.geom.*;
>        import flash.display.*;
>        import flash.events.*;
>
>
>        public class Overlay extends Sprite implements IOverlay
>        {
>
>
>                private var view:View3D = null;
>                private var camera:Camera3D = null;
>
>
>                public var object3D:Object3D;
>                private var scale:Number;
>                private var sourceProjection:Vector3D;
>
>                public var overlayMatrix:Matrix3D = new Matrix3D();
>                private var flipY:Matrix3D = new Matrix3D();
>                private var viewMatrix:Matrix3D = new Matrix3D();
>
>                private var overlayContainer:Sprite;
>                private var testSprite:Sprite;
>
>
>
>                public function Overlay(v:View3D, c:Camera3D, init:Object =
> null)
> {
>                        view = v;
>                        camera = c;
>                        flipY.appendScale(1, -1, 1);
>                        overlayContainer = new Sprite();
>                        this.visible = false;
>                        createTestSprite();
>
>                }
>
>                private function createTestSprite():void {
>                        testSprite = new Sprite();
>                        testSprite.graphics.clear();
>                        testSprite.graphics.beginFill(0xFF0000, 1);
>                        testSprite.graphics.lineStyle(3, 0x000000);
>                        testSprite.graphics.drawRect(-150, -150, 300, 300);
>                        testSprite.graphics.endFill();
>                        setNewSettings();
>                }
>
>
>                private function setNewSettings():void {
>                        object3D = new Object3D();
>                        object3D.x = 0;
>                        object3D.y = 0;
>                        object3D.z = 400;
>
>                        view.scene.addChild(object3D);
>                        this.addChild(testSprite);
>                        view.addOverlay(this);
>                }
>
>
>                public function update():void {
>
>                        sourceProjection = camera.screen(object3D, new
> Vertex(object3D.x,object3D.y,object3D.z));
>
>                        if(!sourceProjection || sourceProjection.z < 0){
>                                if(this.visible) this.visible = false;
>                                return;
>                        }
>                        if(!this.visible) this.visible = true;
>
>                        scale =
> camera.lens.getPerspective(sourceProjection.z);
>
>                        viewMatrix.identity();
>                         viewMatrix.rawData = camera.viewMatrix.rawData;
>                        viewMatrix.prepend(flipY);
>
>                         overlayMatrix.identity();
>                         overlayMatrix.prepend(viewMatrix);
>                        overlayMatrix.prepend(object3D.sceneTransform);
>
>                         scale =
> camera.lens.getPerspective(sourceProjection.z);
>                        overlayMatrix.appendScale(scale,scale,1);
>
>                        overlayMatrix.appendTranslation(sourceProjection.x,
> sourceProjection.y, 0);
>
>                        this.transform.matrix3D = overlayMatrix;
>
>                }
>
>
>        }
> }
>
> I really need help with this, I just have no more ideas what can be
> wrong
>
>
>

Reply via email to