Hi Gurus,

I am working in away3dlite and tried to change the camera to
HoverCamera3D and TargetCamera but it seems that none of them are
working. I cannot change their properties e.g. tiltAngle, distance,
pan etc. Here is my code

/**************************************************************/

package
{
        import away3dlite.cameras.HoverCamera3D;
        import away3dlite.containers.Scene3D;
        import away3dlite.containers.View3D;
        import away3dlite.materials.BitmapFileMaterial;
        import away3dlite.materials.ColorMaterial;
        import away3dlite.primitives.Plane;
        import away3dlite.primitives.Sphere;

        import flash.display.*;
        import flash.events.Event;

        [SWF(backgroundColor="#000000",frameRate=30)]
        public class site extends Sprite
        {
                private var bgMaterial:BitmapFileMaterial;
                private var View:View3D;
                private var bgPlan:Plane;
                private var scene:Scene3D;
                private var mainCam:HoverCamera3D;

                public function site()
                {
                        // create a viewport
                        init();

                        addEvents();

                        addMaterials();
                        resize();
                        addObject();



                }
                private function init():void{
                        scene=new Scene3D();
                        mainCam=new HoverCamera3D();
                        View = new View3D(scene,mainCam);
                        //View.camera=mainCam;
                        addChild(View);

                }
                private function addMaterials():void{
                        bgMaterial=new BitmapFileMaterial("assets/bg.jpg");
                        bgMaterial.smooth=true;
                }

                private function addObject():void{
                        bgPlan = new Plane(bgMaterial);
                        bgPlan.width=1024;
                        bgPlan.height=597;
                        bgPlan.rotationX=90;
                        bgPlan.mouseEnabled=false;
                        scene.addChild(bgPlan);
                }

                private function addEvents():void{

                        addEventListener(Event.ENTER_FRAME,rndr);
                        addEventListener(Event.RESIZE,onResize);
                }

                private function resize():void{
                        stage.align=StageAlign.TOP_LEFT;
                        stage.scaleMode=StageScaleMode.NO_SCALE;
                        //View.camera.z=-600;

                        View.x=stage.stageWidth/2;
                        View.y=stage.stageHeight/2;

                }
                private function onResize(e:Event):void{
                        resize();
                }
                private function rndr(e:Event):void{
                        var xDist:Number = stage.mouseX - stage.stageWidth * 
0.5;
                        var yDist:Number = stage.mouseY - stage.stageHeight * 
0.5;

                        mainCam.tiltAngle=yDist;
                        mainCam.distance+=20;

                        //bgPlan.rotationZ+=10;
                        View.render();
                }
        }
}

/**************************************************************/


Please help me what I am doing wrong.

Riyasat

Reply via email to