By default, the mouse pointer is invisible, and the mouse is set up to control the camera rotation.
The default com.jme3.renderer.Camera object is
cam in com.jme3.app.Application.
The camera object is created with the following defaults:
Width and height are set to the current Application’s settings.getWidth() and settings.getHeight() values.
Frame of view angle of 45° along the Y axis
Aspect ratio of width divided by height
Near view plane of 1 wu
Far view plane of 1000 wu
Start location at (0f, 0f, 10f).
Start direction is looking at the origin.
The camera position
The camera rotation
The left axis of the camera
The up axis of the camera, usually Vector3f(0,1,0)
The vector the camera is facing
One accessor for the three properties left/up/direction.
One accessor for the four properties location/left/up/direction.
cam.resize(width, height, fixAspect)
Resize an existing camera object while keeping all other settings. Set fixAspect to true to adjust the aspect ratio (?)
cam.setFrustum( near, far, left, right, top, bottom )
The frustum is defined by the near/far plane, left/right plane, top/bottom plane (all distances as float values)
cam.setFrustumPerspective( fovY, aspect ratio, near, far)
The frustum is defined by view angle along the Y axis (in degrees), aspect ratio, and the near/far plane.
Turn the camera to look at Coordinate target, and rotate it around the up axis.
Parallel projection perspective
Converts the given position from world space to screen space.
After you change view port, frustum, or frame, call
flyCam class field gives you access to an AppState that extends the default camera in
com.jme3.app.SimpleApplication with more features. The input manager of the
com.jme3.input.FlyByCamera AppState is preconfigured to respond to the WASD keys for walking forwards and backwards, and strafing to the sides; move the mouse to rotate the camera (“Mouse Look), scroll the mouse wheel for zooming in or out. The QZ keys raise or lower the camera vertically.
Q W up forw A S D --> left back right Z down
Activate the flyby cam
Control the move speed
Control the rotation speed
Forces the player to keep mouse button pressed to rotate camera, typically used for Applets. If false (default), all mouse movement will be captured and interpreted as rotations.
The FlyByCamera is active by default, but you can change all these defaults for your game.
jME3 also supports an optional Chase Cam that can follow a moving target Spatial (
com.jme3.input.ChaseCamera). When you use the chase cam, the player clicks and hold the mouse button to rotate the camera around the camera target. You can use a chase cam if you need the mouse pointer visible in your game.
flyCam.setEnabled(false); ChaseCamera chaseCam = new ChaseCamera(cam, target, inputManager);
Interpolates a smoother acceleration/deceleration when the camera moves.
The lower the chasing sensitivity, the slower the camera will follow the target when it moves.
The lower the traling sensitivity, the slower the camera will begin to go after the target when it moves. Default is 0.5;
The lower the sensitivity, the slower the camera will rotate around the target when the mosue is dragged. Default is 5.
This prevents the camera to stop too abruptly when the target stops rotating before the camera has reached the target’s trailing position. Default is 0.1f.
The default distance to the target at the start of the application.
The maximum zoom distance. Default is 40f.
The minimum zoom distance. Default is 1f.
The minimal vertical rotation angle of the camera around the target. Default is 0.
The default vertical rotation angle of the camera around the target at the start of the application.
The default horizontal rotation angle of the camera around the target at the start of the application.