/ Published in: ActionScript 3
Hover around an Object in away3D (will work with papervision3d and other 3D libraries, just plug in the correct data)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//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)); }
URL: http://www.destroyyourcomputer.com