Camera System
RTS Camera Controller
The RTSCameraController is a fully-featured camera system designed for Real-Time Strategy (RTS) and similar top-down games. It provides smooth, intuitive controls that mimic classic RTS titles while also supporting modern gameplay styles like third-person action RPGs.

Overview
The camera controller is built around the concept of a pivot point on the ground. The camera orbits around this point at a configurable distance (zoom), pitch, and yaw angle. This design provides natural-feeling controls where:
Movement translates the pivot point across the world
Zoom moves the camera closer to or further from the pivot
Rotation orbits the camera around the pivot
The RTSCameraController uses Unity's New Input System for all input handling. Ensure you have the Input System package installed and set as the Active Input Handling in Project Settings.
Adding the Camera Controller
Using the Setup Wizard
The easiest way to add the camera controller is through the Setup Wizard:
Go to Tools > Enemy Masses > Setup Wizard
Complete the wizard steps for the RTS Type Enemy Crowd
The wizard automatically adds
RTSCameraControllerto your Main Camera
Manual Setup
To add the controller manually:
Select your Main Camera in the Hierarchy
Add the
RTSCameraControllercomponentAlso add
GPUICamera(required for GPU Instancer Pro rendering)Configure the settings in the Inspector
Camera Presets
Camera presets are ScriptableObject assets that store all camera configuration settings. This allows you to:
Create different camera styles for different game modes
Switch between presets at runtime (e.g., tactical view vs. cinematic view)
Share camera configurations across projects
Built-in Presets
Enemy Masses includes several pre-configured presets:
Classic RTS
Edge pan, middle-mouse drag, scroll zoom. No rotation.
StarCraft, Age of Empires
Modern RTS
WASD movement, middle-mouse rotation, zoom-to-cursor
Company of Heroes
Total War
Edge pan, right-drag pan, middle-drag rotation
Total War series
Supreme Commander
Edge pan, middle-drag pan, right-drag rotation
Supreme Commander
Third Person
Follow target, right-mouse rotation, collision avoidance
Action RPGs, Diablo-style
Creating a Custom Preset
Right-click in the Project window
Select Create > Enemy Masses > Camera Preset
Configure the preset settings in the Inspector
Assign to the camera controller's Camera Presets list
Selecting the Default Preset
When you have multiple presets in the Camera Presets list, you must specify which preset is active by default.
For example, if your preset list contains:
0: Classic RTS
1: Modern RTS
2: Third Person
Set Active Preset Index to 2 to start with the Third Person preset.
The camera automatically applies the active preset on Awake(). You can switch presets at runtime using TransitionToPreset().
Movement Controls
Edge Panning
Move the camera by positioning your mouse cursor at the screen edges.
Enable Edge Pan
Toggle edge panning on/off
true
Edge Pan Border
Pixel distance from edge to trigger (1-50)
10
Edge Pan Speed Multiplier
Speed modifier for edge panning
1.0
Disable Edge Pan Outside Window
Stop panning when cursor leaves game window
true
Keyboard Movement (WASD)
Standard keyboard-based camera movement.
Enable Keyboard Pan
Toggle WASD/Arrow movement
true
Move Speed
Base movement speed
20
Fast Move Speed
Speed when holding Shift
40
Move Acceleration
How quickly camera reaches target speed
8
Move Deceleration
How quickly camera stops
12
Smooth Movement
Enable smooth acceleration/deceleration
true
Default Key Bindings:
W/↑- ForwardS/↓- BackwardA/←- LeftD/→- RightLeft Shift- Sprint (fast move)
Drag Panning
Hold a mouse button and drag to pan the camera (like dragging a map).
Enable Drag Pan
Toggle drag panning
true
Drag Pan Button
Mouse button (Left/Middle/Right)
Middle
Invert Drag Pan
Reverse drag direction
false
Drag Pan Sensitivity
Movement sensitivity (0.1-5.0)
1.0
Zoom Controls
Control the camera's distance from the pivot point using the scroll wheel.
Enable Zoom
Toggle zoom functionality
true
Zoom Speed
Scroll wheel sensitivity
10
Min Zoom Distance
Closest camera distance
5
Max Zoom Distance
Furthest camera distance
100
Smooth Zoom
Enable smooth zoom interpolation
true
Zoom Smooth Speed
Interpolation speed
8
Zoom To Cursor
Zoom towards mouse position (Google Maps style)
true
Zoom to Cursor provides a more intuitive zoom experience, especially when zooming in on specific units or locations. The camera moves towards wherever your cursor is pointing.
Rotation Controls
Rotate and tilt the camera to view the battlefield from different angles.
Enable Rotation
Toggle rotation controls
true
Rotation Button
Mouse button to hold for rotation
Right
Rotation Speed
Mouse sensitivity for rotation
1.0
Rotate Without Button
Always rotate with mouse movement
false
Enable Tilt
Allow vertical camera tilt (pitch)
true
Min Tilt Angle
Minimum pitch angle (°)
30
Max Tilt Angle
Maximum pitch angle (°)
80
Smooth Rotation
Enable smooth rotation interpolation
true
Rotation Smooth Speed
Interpolation speed
10
Camera Bounds
Restrict camera movement to a defined area (useful for keeping players within map boundaries).
Enable Bounds
Toggle movement boundaries
true
Min X / Max X
Horizontal (X-axis) boundaries
-100 / 100
Min Z / Max Z
Vertical (Z-axis) boundaries
-100 / 100
Bounds Mesh Renderer
Optional: Auto-set bounds from a mesh's AABB
null
Assign a Bounds Mesh Renderer to automatically calculate camera bounds from a plane or terrain mesh. This is especially useful when your map size changes during development.
Camera Bookmarks
Save and recall camera positions quickly using keyboard shortcuts—essential for competitive RTS gameplay.
Enable Bookmarks
Toggle bookmark system
true
Bookmark Slots
Number of available slots (1-9)
4
Smooth Bookmark Transition
Animate when recalling bookmarks
true
Bookmark Transition Speed
Animation speed
5
Default Controls:
Alt + 1-9- Save current camera position to bookmark slot1-9- Recall saved bookmark position
Using Bookmarks via Script
Follow Mode (Third Person)
The camera can follow a target transform, useful for third-person gameplay or following selected units.
Follow Target
Transform to follow
null
Follow Mode
Enable/disable following
false
Follow Smoothness
How quickly camera catches up
5
Follow Target Offset
Offset from target position
(0, 0, 0)
Follow Offset In Target Space
Apply offset in target's local space
false
Follow Use Target Height
Use target's Y position for pivot height
false
Follow Target Height Offset
Vertical offset when using target height
1.5
Look-Ahead Settings
For smoother following of moving targets:
Enable Lookahead
Predict and lead target movement
false
Lookahead Time
Seconds to project ahead
0.2
Lookahead Smooth Time
Smoothing for lookahead changes
0.15
Max Lookahead Distance
Maximum lookahead offset
3
Starting/Stopping Follow Mode
Camera Collision
Prevent the camera from clipping through walls and terrain—essential for third-person gameplay.
Enable Camera Collision
Toggle collision avoidance
false
Camera Collision Layers
Layer mask for collision detection
Everything
Camera Collision Radius
Size of collision probe sphere
0.25
Camera Collision Buffer
Extra distance from surfaces
0.1
Camera Collision Ignore Triggers
Skip trigger colliders
true
Line of Sight Ground Repositioning
For cameras with negative pitch (looking upward):
Enable Line Of Sight Ground Reposition
Move camera along line-of-sight when blocked
false
Line Of Sight Ground Buffer
Extra distance from ground
0.1
Terrain Following
Keep the camera at a consistent height above the terrain.
Terrain Following
Toggle terrain height tracking
false
Height Above Ground
Target height above terrain
0
Ground Layer
Layer mask for ground detection
Everything
Preset Transitions
Smoothly animate between different camera presets at runtime.
Enable Preset Transitions
Toggle smooth transitions
true
Preset Transition Duration
Animation duration (seconds)
0.6
Preset Transition Curve
Animation easing curve
EaseInOut
Transitioning Between Presets
Integration with Other Systems
Game Creator 2 Integration
When using Game Creator 2 alongside the RTS Camera Controller, you typically want Game Creator's camera system to handle the camera initially (e.g., during menus, cutscenes, or third-person gameplay), then transition to RTS controls when needed.
Recommended Setup:
On the
RTSCameraController, disableControl Active On StartUse Game Creator 2's camera system as your primary camera
When you want to switch to RTS controls, call
SetControlActive(true)via a Game Creator Action or script
| Setting | Description | Default | |---------|-------------|---------|| | Control Active On Start | Whether the camera controller processes input immediately | true |
If Control Active On Start is enabled while Game Creator 2 is also controlling the camera, both systems will fight for control, causing erratic camera behavior.
Example: Switching from Game Creator to RTS Camera
Disabling Camera Control
When using cutscenes, other camera systems, or UI dialogs, you may need to temporarily disable the camera controller:
Syncing with External Cameras
If another system moves the camera (e.g., Game Creator 2, Cinemachine), sync the controller when returning:
Suppressing Zoom Input
Prevent scroll wheel conflicts with other systems (e.g., formation cycling):
Public API Reference
Position & Movement
Zoom
Rotation
Bounds
Effects
Enable/Disable Controls
Events
Subscribe to camera events for integration with other systems:
Advanced Settings
Unscaled Time
Use Unscaled Time
Camera works during Time.timeScale = 0
true
This allows camera movement even when the game is paused.
Initial Setup
Configure the camera's starting state:
Initial Zoom
Starting camera distance
20
Initial Pitch
Starting vertical angle
45
Initial Yaw
Starting horizontal angle
0
Troubleshooting
Camera Not Moving
Ensure
Control Active On Startis enabledCheck that the relevant movement options are enabled (
Enable Edge Pan,Enable Keyboard Pan, etc.)Verify Input System is properly configured
Camera Clipping Through Geometry
Enable
Enable Camera CollisionSet
Camera Collision Layersto include your wall/terrain layersIncrease
Camera Collision Radiusif camera still clips
Zoom Conflicts with Formation Cycling
The RTS Controller uses scroll wheel for formation cycling. Use SuppressZoom() or the built-in integration handles this automatically.
Jerky Movement During Rotation
Enable
Smooth MovementandSmooth RotationIncrease
Rotation Smooth SpeedEnsure frame rate is stable
Best Practices
Use Presets: Create ScriptableObject presets rather than configuring in-scene for reusability
Tune Bounds Early: Set up camera bounds that match your playable area
Test at Different Zooms: Ensure edge panning and drag panning feel good at both close and far zoom levels
Consider Follow Mode: For Action RPG hybrids, use the Third Person preset with collision enabled
Save Performance: Disable unused features (e.g., terrain following if you have flat terrain)
Related Components
EnemyMassesRTSController - Unit selection and commands
RTSMinimapController - Minimap rendering
FogOfWarLite - Visibility system
Last updated