public class FlightCamera
extends java.lang.Object
FlyByCamera
. Differences include the ability to rotate or roll
the camera around the axis along which the camera is pointing. This class
also includes a more verbose interface for camera movement and rotation to
make it easier for external classes to directly manipulate the camera.
The following controls move the camera:
Constructor and Description |
---|
FlightCamera(com.jme3.renderer.Camera camera)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of all resources associated with this camera.
|
boolean |
getEnabled()
Gets whether or not the camera is enabled.
|
void |
pitchCamera(float radians)
Changes the pitch of the camera (rotates up and down).
|
void |
raiseCamera(float distance)
Moves the camera up or down.
|
void |
rollCamera(float radians)
Rotates (rolls) the camera right or left.
|
void |
setEnabled(boolean enabled)
Enables or disables the camera.
|
void |
setInputManager(com.jme3.input.InputManager input)
Sets the
InputManager associated with this camera. |
void |
setMoveSpeed(float moveSpeed)
Sets the rate at which the camera moves.
|
void |
setOrientation(com.jme3.math.Vector3f direction,
com.jme3.math.Vector3f up)
Sets the orientation of the camera at once, as opposed to incremental
orientation.
|
void |
setPosition(com.jme3.math.Vector3f position)
Sets the position of the camera at once, as opposed to incremental
positioning.
|
void |
setRotationSpeed(float rotationSpeed)
Sets the rate at which the camera rotates.
|
void |
setZoomSpeed(float zoomSpeed)
Sets the rate at which the camera zooms.
|
void |
strafeCamera(float distance)
Moves the camera right or left.
|
void |
thrustCamera(float distance)
Moves the camera forward or backward.
|
void |
yawCamera(float radians)
Changes the yaw of the camera right or left.
|
void |
zoomCamera(float value)
Zooms the camera in or out.
|
public FlightCamera(com.jme3.renderer.Camera camera)
camera
- The camera used for rendering (i.e., it determines when to
cull objects that are not in the view).public void dispose()
public void zoomCamera(float value)
value
- The amount by which to zoom in or out. Negative zooms in,
positive zooms out.public void thrustCamera(float distance)
distance
- If positive, the camera moves forward. If negative, the camera
moves backward.public void strafeCamera(float distance)
distance
- If positive, the camera moves right. If negative, the camera
moves left.public void raiseCamera(float distance)
distance
- If positive, the camera moves up. If negative, the camera
moves down.public void rollCamera(float radians)
radians
- If positive, the camera rolls right. If negative, the camera
rolls left.public void pitchCamera(float radians)
radians
- If positive, the camera pitches up. If negative, the camera
pitches down.public void yawCamera(float radians)
radians
- If positive, the camera rotates right. If negative, the camera
rotates left.public void setPosition(com.jme3.math.Vector3f position)
position
- The new position. If null, an exception is thrown.thrustCamera(float)
,
strafeCamera(float)
,
raiseCamera(float)
public void setOrientation(com.jme3.math.Vector3f direction, com.jme3.math.Vector3f up)
direction
- The new direction in which the camera will point. If null, an
exception is thrown.up
- The new up direction. If null or if it is not orthogonal to
the camera direction, an exception is thrown.rollCamera(float)
,
pitchCamera(float)
,
yawCamera(float)
public boolean getEnabled()
public void setEnabled(boolean enabled)
InputManager
, then this method registers the camera controls
with said InputManager
. Likewise, if the camera is disabled
and has an InputManager
, this method unregisters the camera
controls.enabled
- If true, the camera is enabled. If false, the camera is
disabled.public void setInputManager(com.jme3.input.InputManager input)
InputManager
associated with this camera. If the
camera is already enabled, this method unregisters from the previous
InputManager
and registers with the new one.input
- The new InputManager
.public void setMoveSpeed(float moveSpeed)
3.0
.moveSpeed
- The new move speed. This should not be negative.public void setRotationSpeed(float rotationSpeed)
1.0
.rotationSpeed
- The new rotation speed. This should not be negative.public void setZoomSpeed(float zoomSpeed)
1.0
.zoomSpeed
- The new zoom speed. This should not be negative.