Last active
August 29, 2015 14:05
-
-
Save keyle/ece0f90a4a72e9b0a9fb to your computer and use it in GitHub Desktop.
Fullscreen FPS the right way?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stage.addEventListener(MouseEvent.MOUSE_MOVE, mousemove, false, 0, true); | |
| scene3D.addEventListener(Scene3D.UPDATE_EVENT, update, false, 0, true); | |
| private function mousemove(event:MouseEvent):void | |
| { | |
| if (event.movementX != 0) { | |
| const mouseMoveX:Number = (event.movementX); | |
| spinX += mouseMoveX * 0.035; | |
| } | |
| if (event.movementY != 0) { | |
| const mouseMoveY:Number = (event.movementY); | |
| spinY += mouseMoveY * 0.035; | |
| } | |
| } | |
| private function update(event:Event):void | |
| { | |
| player.rotateY(spinX, true); | |
| spinX *= .51; | |
| scene.camera.rotateX(spinY, true); | |
| spinY *= .51; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I move the mouse left slowly while moving forward (WASD), the camera goes spastic. That's why I tried to fix it with spinX *= .51;
Still not great.
Any help appreciated :)