RTS Camera Controller

The RTS Camera Controller is a modern, feature-rich camera system designed for Real-Time Strategy games. It supports multiple control schemes (Classic, Modern, Total War style), smooth movement, bookmarks, and full integration with Unity's new Input System.

Features

  • Multiple Control Schemes: Pre-configured presets for popular RTS styles (StarCraft, Company of Heroes, Total War).

  • Movement: Edge panning, WASD keyboard movement, and drag panning.

  • Zoom & Rotation: Smooth zooming (with "zoom to cursor") and orbital rotation.

  • Camera Bookmarks: Save and load camera positions instantly (like Alt+1 to save, 1 to load).

  • Terrain Following: Automatically maintains height above complex terrain.

  • Follow Mode: Lock onto and follow units or heroes.

  • Bounds: Restrict camera movement to a specific play area.


Getting Started

  1. Create a new Camera or select your Main Camera.

  2. Add the RTSCameraController component.

  3. (Optional) Assign a Bounds Mesh Renderer (like your terrain or a ground plane) to automatically set the movement limits.


Control Schemes

The controller comes with built-in presets to match different RTS playstyles. You can change this via the Control Scheme dropdown.

Scheme
Description
Controls

Classic RTS

Old-school style (StarCraft, Age of Empires).

Pan: Edge Pan / Middle Mouse Drag Zoom: Scroll Wheel

Modern RTS

Standard for modern tactics (Company of Heroes).

Pan: WASD / Edge Pan Rotate: Right Mouse Drag Zoom: Scroll Wheel

Total War

Hybrid style.

Pan: Edge Pan / Right Mouse Drag Rotate: Middle Mouse Drag

Supreme Commander

Strategic zoom focus.

Pan: Edge Pan / Middle Mouse Drag Rotate: Right Mouse Drag

Custom

Fully configurable.

Define your own input combinations.


Key Features & Settings

1. Movement & Panning

  • Edge Panning: Moves the camera when the mouse cursor touches the edge of the screen.

  • Keyboard Pan: Uses WASD or Arrow keys.

  • Drag Pan: Hold a mouse button (Middle/Right/Left) and drag the scene.

  • Sprint: Hold Shift to move faster.

2. Zooming

  • Zoom to Cursor: If enabled, zooming in will move the camera towards the mouse position (like Google Maps), rather than just moving forward.

  • Min/Max Distance: Limits how close or far you can zoom.

3. Rotation

  • Orbit: Hold the designated rotation key (default: Right Mouse) to orbit around the center of the screen.

  • Tilt Limits: Restrict how low or high the camera can tilt (Pitch).

4. Camera Bookmarks

Just like in classic RTS games, players can save specific camera locations.

  • Save: Hold Alt + Number Key (1-9).

  • Load: Press Number Key (1-9).

  • Settings: You can configure the number of slots and the modifier key in the Inspector.

5. Terrain Following

If your map has hills or uneven ground, enable Terrain Following.

  • Ground Layer: Set this to your terrain layer.

  • Height Above Ground: The camera will raycast down and adjust its height to ensure it doesn't clip through hills.


Game Creator 2 Integration

The RTS Camera Controller includes custom Instructions for Game Creator 2, allowing you to control the camera via visual scripting.

Instructions

  • Set RTS Camera Follow Target: Tells the camera to lock onto a specific Transform (e.g., a Hero unit).

  • Set RTS Camera Follow Mode: Enables or disables the follow behavior.


Input System Note

This controller uses Unity's New Input System (UnityEngine.InputSystem).

  • The component generates its own Input Actions internally by default, so you don't need to create an .inputactions asset manually.

  • You can rebind keys directly in the Inspector (e.g., changing "Move Forward" from W to Up Arrow).

Last updated