Controlling 3-D cameras
Because so many JMonkeyEngine demos use the FlyByCamera
camera controller,
Acorus integrates closely with it.
Acorus also provides a good base for implementing custom camera controllers.
TestToggleFly
TestToggleFly
is a test application that modifies TestSimpleApplication
by adding an action to toggle the state of the FlyByCamera
.
-
Initially, the camera controller is enabled.
-
Pressing t or Tab disables the controller.
-
Pressing t or Tab again re-enables the controller.
Notice how the input bindings change each time the camera controller gets enabled or disabled. Each change is reflected in the help node.
CameraOrbitAppState
FlyByCamera
is a useful camera controller,
but it’s inconvenient for studying a 3-D object from all sides.
One could, of course, use ChaseCameraAppState
, but often that’s overkill.
As an alternative, Acorus offers CameraOrbitAppState
(COAS for short),
a built-in camera controller to augment FlyByCamera
with orbital motion.
COAS uses 2 signals to make a camera orbit (move in a circle around) the global Y axis in each direction.
COAS is entirely controlled signals, and doesn’t care what hotkeys are bound to them. This design makes it easy to customize which hotkeys do what.
HelloCoas
HelloCoas
is an example application that modifies TestSimpleApplication
by attaching a CameraOrbitAppState
.
The left- and right-arrow keys
are bound to signals that control orbital motion.
Other examples
For custom camera controllers, signals promote clean separation between the input mappings and motion logic.
For more examples of Acorus-based camera controllers, see the Garrett project.