com.badlogic.gdx.graphics.g3d.utils
Class FirstPersonCameraController

java.lang.Object
  extended by com.badlogic.gdx.InputAdapter
      extended by com.badlogic.gdx.graphics.g3d.utils.FirstPersonCameraController
All Implemented Interfaces:
InputProcessor

public class FirstPersonCameraController
extends InputAdapter

Takes a Camera instance and controlls it via w,a,s,d and mouse panning.

Author:
badlogic

Constructor Summary
FirstPersonCameraController(Camera camera)
           
 
Method Summary
 boolean keyDown(int keycode)
          Called when a key was pressed
 boolean keyUp(int keycode)
          Called when a key was released
 void setDegreesPerPixel(float degreesPerPixel)
          Sets how many degrees to rotate per pixel the mouse moved.
 void setVelocity(float velocity)
          Sets the velocity in units per second for moving forward, backward and strafing left/right.
 boolean touchDragged(int screenX, int screenY, int pointer)
          Called when a finger or the mouse was dragged.
 void update()
           
 void update(float deltaTime)
           
 
Methods inherited from class com.badlogic.gdx.InputAdapter
keyTyped, mouseMoved, scrolled, touchDown, touchUp
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FirstPersonCameraController

public FirstPersonCameraController(Camera camera)
Method Detail

keyDown

public boolean keyDown(int keycode)
Description copied from interface: InputProcessor
Called when a key was pressed

Specified by:
keyDown in interface InputProcessor
Overrides:
keyDown in class InputAdapter
Parameters:
keycode - one of the constants in Input.Keys
Returns:
whether the input was processed

keyUp

public boolean keyUp(int keycode)
Description copied from interface: InputProcessor
Called when a key was released

Specified by:
keyUp in interface InputProcessor
Overrides:
keyUp in class InputAdapter
Parameters:
keycode - one of the constants in Input.Keys
Returns:
whether the input was processed

setVelocity

public void setVelocity(float velocity)
Sets the velocity in units per second for moving forward, backward and strafing left/right.

Parameters:
velocity - the velocity in units per second

setDegreesPerPixel

public void setDegreesPerPixel(float degreesPerPixel)
Sets how many degrees to rotate per pixel the mouse moved.

Parameters:
degreesPerPixel -

touchDragged

public boolean touchDragged(int screenX,
                            int screenY,
                            int pointer)
Description copied from interface: InputProcessor
Called when a finger or the mouse was dragged.

Specified by:
touchDragged in interface InputProcessor
Overrides:
touchDragged in class InputAdapter
pointer - the pointer for the event.
Returns:
whether the input was processed

update

public void update()

update

public void update(float deltaTime)


Copyright © 2013. All Rights Reserved.