Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Cameras
  4. Camera Movement

Camera Movement

The Camera Movement component manages the movement of the main camera and the minimap camera.

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


General Settings:

  1. Main Camera: Main camera object field (in the demo’s case, it’s the same object that includes this script).
  2. Camera Height: The height of the camera which is the camera’s object position on the y-axis.
  3. Flat Terrain: Drag and drop the map’s flat terrain in this field.

Camera Movement:

  1. Movement Speed: The movement speed of the camera.
  2. Movement Keys: Set the four keys that the player can use to move up, down, right and left.
  3. Move On Screen Edge: If true, then when the player’s mouse is on the screen’s edge, the camera will move in the edge’s direction.
  4. Screen Edge Size: Define the size of the screen edge size in this field.
  5. Screen Limit: If true, then the camera’s movement will be limited by maximum (Max Pos) and minimum (Min Pos) values on both the x-axis and the y-axis.

Panning:

  1. Panning: Enable/Disable panning.
  2. Panning Key: Key that triggers the main camera panning.
  3. Panning Speed: How fast should the camera panning be?

Zoom:

  1. Zoom Enabled: If true, then the player will be able to zoom in and out.
  2. Can Zoom With Key: If true, the player will be able to use keys to zoom in and out.
  3. Zoom In/Out key: Pick keys that allow the player to zoom in and out.
  4. Max & Min FOV: Maximum and minimum zoom values.
  5. Zoom Smooth Time: Determines how fast the zoom in/out process is.
  6. Zoom On Mouse Wheel: If true, then the player will also be able to use the mouse wheel in addition to the keys above in order to zoom in and out.
  7. Zoom Scroll Wheel Sensitivity: Self-explanatory.
  8. Zoom Scroll Wheel Speed: Self-explanatory.

Follow Unit:

  1. Can Follow Unit: if true, then the player will be able to follow a selected unit with the camera by pressing a certain key.
  2. Follow Unit Key: The key to press to be able to follow a selected unit with the camera.

Minimap Camera:

  1. Minimap Cam: Drag and drop the minimap camera in this field, the minimap camera should be a camera that looks at all the map’s terrain at the same time. It shouldn’t have any GUI Layer, Flare Layer or anything else but the camera component. You can also play with the Viewport Rect values in order to place the camera in the screen.
  2. Offset X & Z: When the player clicks on a position in the map in the minimap’s camera, the camera position shifts to that position. The offset X & Z are two values added to the main camera’s position respectively at the x-axis and z-axis when applying that move.
  3. Minimap Canvas: A separate canvas to show the minimap cursor texture at.
  4. Minimap Cursor: UI Image, child of the “Minimap Canvas”. This UI Image indicates where the camera is looking at exactly in the minimap.

UI Camera:

  1. UI Cam: Drag and drop the UI camera in this field.

How can we help?