public class FPSCameraController extends BasicCameraController
ArcBallController provides 3D editor like features to a camera, by rotating around a point and letting the user zoom in and out.
Constructor and Description |
---|
FPSCameraController(javafx.scene.Camera camera,
javafx.scene.Scene scene,
javafx.embed.swt.FXCanvas canvas)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
handleKeyPressed(javafx.scene.input.KeyEvent event)
This function defines the camera's behavior when a keyboard button is
pressed.
|
void |
handleMouseDragged(javafx.scene.input.MouseEvent event)
This function defines the camera's behavior when the mouse is dragged.
|
void |
handleMousePressed(javafx.scene.input.MouseEvent event)
This function defines the camera's behavior when a mouse button is
pressed.
|
void |
handleMouseReleased(javafx.scene.input.MouseEvent event)
This function defines the camera's behavior when a mouse button is
released.
|
void |
handleMouseScroll(javafx.scene.input.ScrollEvent event)
This function defines the camera's behavior when the mouse wheel is
scrolled.
|
void |
initCamera()
Set up the various data structures needed for the camera's operation.
|
void |
pitchCamera(double radians)
Change the camera's pitch, its rotation about the axis perpendicular to
its heading to the right, controlling how it is pointed in an up/down
direction.
|
void |
raiseCamera(double distance)
Move the camera to the up or down, orthogonal to the direction it is
pointing.
|
void |
reset()
Resets the camera to its default position.
|
void |
rollCamera(double radians)
Change the camera's roll, it's rotation about the axis it is pointing.
|
void |
strafeCamera(double distance)
Move the camera to the left or right, orthogonal to the direction it is
pointing.
|
void |
thrustCamera(double distance)
Move the camera forward or backwards in the direction it is pointing.
|
void |
yawCamera(double radians)
Change the camera's yaw, its rotation about the axis perpendicular to its
heading in to the above, controlling how it is pointed in a left/right
direction.
|
setDefaultAngle
public FPSCameraController(javafx.scene.Camera camera, javafx.scene.Scene scene, javafx.embed.swt.FXCanvas canvas)
camera
- The camera this controller will manage.scene
- The scene the camera is viewing.canvas
- The FXCanvas containing the scene.public void handleKeyPressed(javafx.scene.input.KeyEvent event)
BasicCameraController
handleKeyPressed
in class BasicCameraController
event
- An event sent to the scene.public void handleMouseDragged(javafx.scene.input.MouseEvent event)
BasicCameraController
handleMouseDragged
in class BasicCameraController
event
- An event sent to the scene.public void handleMousePressed(javafx.scene.input.MouseEvent event)
BasicCameraController
handleMousePressed
in class BasicCameraController
event
- An event sent to the scene.public void handleMouseScroll(javafx.scene.input.ScrollEvent event)
BasicCameraController
handleMouseScroll
in class BasicCameraController
event
- An event sent to the scene.public void initCamera()
BasicCameraController
public void reset()
ICameraController
reset
in interface ICameraController
reset
in class BasicCameraController
public void pitchCamera(double radians)
ICameraController
pitchCamera
in interface ICameraController
pitchCamera
in class BasicCameraController
radians
- The number of radians by which to rotate the camera.public void rollCamera(double radians)
ICameraController
rollCamera
in interface ICameraController
rollCamera
in class BasicCameraController
radians
- The number of radians by which to rotate the camera.public void raiseCamera(double distance)
ICameraController
raiseCamera
in interface ICameraController
raiseCamera
in class BasicCameraController
distance
- The amount of space to move the camera. Positive distances
move the camera up, negative distances move it down.public void strafeCamera(double distance)
ICameraController
strafeCamera
in interface ICameraController
strafeCamera
in class BasicCameraController
distance
- The amount of space to move the camera. Positive distances
move the camera right, negative distances move it left.public void thrustCamera(double distance)
ICameraController
thrustCamera
in interface ICameraController
thrustCamera
in class BasicCameraController
distance
- The amount of space to move the camera. Positive distances
move the camera forward, negative distances move it backwards.public void yawCamera(double radians)
ICameraController
yawCamera
in interface ICameraController
yawCamera
in class BasicCameraController
radians
- The number of radians by which to rotate the camera.public void handleMouseReleased(javafx.scene.input.MouseEvent event)
BasicCameraController
handleMouseReleased
in class BasicCameraController
event
- An event sent to the scene.