Return to Snippet

Revision: 21653
at December 17, 2009 12:55 by allnatural


Initial Code
//in enterframe function 
         hoverCamera(currentObject); 
          
         //function 
         private function hoverCamera(_currentObject:ObjectContainer3D):void 
         { 
              var mX:Number = this.mouseX > 0 ? this.mouseX : 0; 
              var mZ:Number = this.mouseY > 0 ? this.mouseY : 0; 
               
              var tarX:Number = 3*(mX - stage.stageWidth/2); 
              var tarZ:Number = -2*(mZ - stage.stageHeight/2); 
               
              var dX:Number = camera.x - tarX; 
              var dZ:Number = camera.z - tarZ; 
               
              camera.x -= dX*0.25; 
              camera.z -= dZ*0.25; 
              camera.lookAt(new Number3D(_currentObject.x, 50, _currentObject.z)); 
         }

Initial URL
http://www.destroyyourcomputer.com

Initial Description
Hover around an Object in away3D (will work with papervision3d and other 3D libraries, just plug in the correct data)

Initial Title
Away3D Object Hover Camera Functionality

Initial Tags

                                

Initial Language
ActionScript 3