APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.graphics.g3d.utils

public Class FirstPersonCameraController

extends InputAdapter
Class Inheritance
Imports
com.badlogic.gdx.Gdx, .Input.Keys, .InputAdapter, com.badlogic.gdx.graphics.Camera, com.badlogic.gdx.math.Vector3, com.badlogic.gdx.utils.IntIntMap

Takes a Camera instance and controls it via w,a,s,d and mouse panning.
Author
badlogic

Field Summary

Modifier and TypeField and Description
public boolean
public int
protected final Camera
protected float
public int
public int
protected final IntIntMap
public int
public int
protected final Vector3
public int
protected float

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
keyDown(int keycode)

Overrides com.badlogic.gdx.InputAdapter.keyDown.

Implements com.badlogic.gdx.InputProcessor.keyDown.

Called when a key was pressed

public boolean
keyUp(int keycode)

Overrides com.badlogic.gdx.InputAdapter.keyUp.

Implements com.badlogic.gdx.InputProcessor.keyUp.

Called when a key was released

public void
setDegreesPerPixel(float degreesPerPixel)

Sets how many degrees to rotate per pixel the mouse moved.

public void
setVelocity(float
the velocity in units per second
velocity
)

Sets the velocity in units per second for moving forward, backward and strafing left/right.

public boolean
touchDragged(int screenX, int screenY, int pointer)

Overrides com.badlogic.gdx.InputAdapter.touchDragged.

Implements com.badlogic.gdx.InputProcessor.touchDragged.

Called when a finger or the mouse was dragged.

public void
public void
update(float deltaTime)

Inherited from com.badlogic.gdx.InputAdapter:
keyTypedmouseMovedscrolledtouchCancelledtouchDowntouchUp

Field Detail

autoUpdateback to summary
public boolean autoUpdate
backwardKeyback to summary
public int backwardKey
cameraback to summary
protected final Camera camera
degreesPerPixelback to summary
protected float degreesPerPixel
downKeyback to summary
public int downKey
forwardKeyback to summary
public int forwardKey
keysback to summary
protected final IntIntMap keys
strafeLeftKeyback to summary
public int strafeLeftKey
strafeRightKeyback to summary
public int strafeRightKey
tmpback to summary
protected final Vector3 tmp
upKeyback to summary
public int upKey
velocityback to summary
protected float velocity

Constructor Detail

FirstPersonCameraControllerback to summary
public FirstPersonCameraController(Camera camera)

Method Detail

keyDownback to summary
public boolean keyDown(int keycode)

Overrides com.badlogic.gdx.InputAdapter.keyDown.

Implements com.badlogic.gdx.InputProcessor.keyDown.

Doc from com.badlogic.gdx.InputProcessor.keyDown.

Called when a key was pressed

Annotations
@Override
keyUpback to summary
public boolean keyUp(int keycode)

Overrides com.badlogic.gdx.InputAdapter.keyUp.

Implements com.badlogic.gdx.InputProcessor.keyUp.

Doc from com.badlogic.gdx.InputProcessor.keyUp.

Called when a key was released

Annotations
@Override
setDegreesPerPixelback to summary
public void setDegreesPerPixel(float degreesPerPixel)

Sets how many degrees to rotate per pixel the mouse moved.

setVelocityback to summary
public void setVelocity(float velocity)

Sets the velocity in units per second for moving forward, backward and strafing left/right.

Parameters
velocity:float

the velocity in units per second

touchDraggedback to summary
public boolean touchDragged(int screenX, int screenY, int pointer)

Overrides com.badlogic.gdx.InputAdapter.touchDragged.

Implements com.badlogic.gdx.InputProcessor.touchDragged.

Doc from com.badlogic.gdx.InputProcessor.touchDragged.

Called when a finger or the mouse was dragged.

Annotations
@Override
updateback to summary
public void update()
updateback to summary
public void update(float deltaTime)