Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Cameras
  4. Main Camera Controller

Main Camera Controller

The Camera Controller component manages panning, rotation, zooming among other things for the main camera.

When you’re creating a new map using the RTS Engine menu editor, this component is attached to an object called “MainCameraManager”.


General:

  1. Main Camera: Drag and drop the main camera in the map scene into this field.
  2. Minimap Camera Controller: Drag and drop the object that has the Minimap Camera Controller component attached to it.
  3. Terrain Layer Mask: Defines the layers assigned to the terrain objects.

Panning:

  1. Panning Speed: How fast does the main camera move?
  2. Input Axis Panning: When enabled, the player will be able to use the input axis defined in the Input Manager to move the main camera, the Horizontal and Vertical fields allow to enter the names of the input axis for each movement direction.
  3. Keyboard Key Panning: When enabled, the player will be able to use keyboard keys defined by key codes in the Up, Down, Right and Left fields to pan the main camera.
  4. Screen Edge Panning: When enabled and when the player’s mouse is over the screen’s edge (whose size/length is define by the Size field), then the main camera will pan towards the edge’s direction in the screen. If the Ignore UI is also disabled then when the mouse is over a UI element on the screen’s edge, the camera will not move.
  5. Pan Limit: When enabled, the main camera’s movement will be limited by a minimum position (on the x and z axis) defined in Min Position and by a maximum position (on the x and the z axis) defined by Max Position.

Rotation:

  1. Initial Euler Angles: Defines the initial camera rotation.
  2. Update Minimap Cam Rotation: When enabled, the minimap camera will initialize by having a rotation that fits the chosen initial rotation of the main camera in the above field.
  3. Fix Pan Rotation: When enabled, the main camera’s rotation will be fixed to the initial value when the camera moves by at least a difference defined in the Allowed Rotation Pan Size field.
  4. Rotation Speed: How fast does the main camera rotate (on the y-axis only)?
  5. Rotation Limit: When enabled, the Min field defines the minimum allowed rotation value on the y-axis and Max field defines the maximum allowed rotation value.
  6. Keyboard Key Rotation: When enabled, player will be only to use the keys defined by key codes in the Positive (positive rotation key) and Negative (negative rotation key) fields.
  7. Mouse Wheel Rotation: When enabled, the player can press their mouse wheel and drag the mouse to rotate the main camera. The Smooth Factor defines the sensitivity of the mouse drag movement.

Zooming:

  1. Zoom Speed: How fast can the main camera zoom in/out?
  2. Mouse Wheel Zoom: When enabled, the player can use their mouse wheel in order to zoom in or out. The Name field allows to define the axis that tracks the mouse scroll wheel movement in the Input Manager. The Sensitivity field defines the multiplier value for the mouse scroll wheel movement. Finally, the Invert field allows to invert the scroll wheel zooming when it’s enabled.
  3. Keyboard Key Zoom: When enabled, the key codes defined in the In Key and Out Key fields can be used by the player to zoom the main camera in and out respectively.
  4. Zoom FOV: When enabled, zooming will happen by modifying the field of view (FOV) value of the main camera and not its actual height (position).
  5. Initial Height: Defines the initial height (or initial field of view) of the main camera (when the game starts).
  6. Min/Max Height: How close/far can the player zoom the main camera in/out? (Also represent the min and max field of view values).

Look At:

  1. Offset X/Z: The main camera position on the x- and z-axis will be offset by this value.
  2. Smooth Follow: When enabled, the main camera will be able to follow selected entities smoothly. Check out the Selection Manager for settings regarding following selected entities. The Smooth Follow Factor defines how smooth the camera follow is.
  3. Stop Following On Movement: When enabled, the main camera will stop following the selected entity(ies) when the player moves it.

How can we help?