The CameraManager Component

The CameraManager component is responsible for the following aspects of the game:

  • Creating and managing different cameras for the game
  • Responding to camera related commands from the user such as switching between cameras.

The default CameraManager generated by kheljs creates a scene camera which allows the scene to be viewed from a distance. The scene camera is usually not active. It is the player camera created by the PlayerManager component that is normally active in the game. You can toggle between the scene camera and the player's camera by pressing the key "t" on your keyboard.

To add additional cameras for your game, create these cameras from the CemaraManager class during initialization and store them as member variables. To respond to user commands, provide one or more implementation of CameraAction interface to perform any operation related to cameras. An example implementation is the generated ToggleSceneCamera class which toggles view between player camera and scene camera.