RTS Camera in Unreal Engine
In this tutorial, you will build a complete RTS style camera system in Unreal Engine using Blueprints. The system includes smooth camera movement, zoom, rotation, middle mouse camera control, edge scrolling, input mode setup, mouse locking, and a custom game mode so the camera becomes the default player pawn.
This is an older RTS camera tutorial. It still teaches useful camera architecture, Blueprint logic, and classic input workflows, but there is now a newer and cleaner RTS Camera Series available on the Rambod Dev channel. The newer version uses Enhanced Input and breaks the system into smaller step by step episodes, which is easier to follow and better for modern Unreal Engine projects.
Watch the full video tutorial: Unreal Engine RTS Camera Setup Smooth Movement And Controls
Newer RTS Camera project files: UE5 RTS Camera Tutorial GitHub Repository
What This RTS Camera System Includes
An RTS camera is different from a normal third person camera. In a third person game, the camera usually follows a character. In an RTS, strategy, management, city builder, colony sim, tactical game, or simulation project, the camera is often the player. It moves independently across the world and lets the player inspect the map from above.
This tutorial builds the core features needed for that kind of camera:
- Smooth forward and backward camera movement
- Smooth left and right camera movement
- Zoom in and zoom out using the mouse wheel
- Camera yaw rotation using keyboard input
- Mouse based camera rotation with middle mouse button
- Camera pitch control with clamping
- Mouse edge scrolling when the cursor reaches the screen border
- Input mode setup so the cursor stays visible and usable
- Mouse locking inside the game window
- Custom pawn and game mode setup
By the end, you will have a reusable camera pawn that can become the base for an RTS, city builder, strategy prototype, tower defense game, simulation tool, or editor style gameplay system.
Important Note About This Older Workflow
This tutorial uses the older Unreal Engine input system based on Action Mappings and Axis Mappings in Project Settings. That workflow still works, but for newer Unreal Engine projects, Enhanced Input is the better choice.
Enhanced Input gives you cleaner input actions, better modifier support, easier rebinding, improved controller support, and a more scalable structure. That is why the newer RTS Camera Series on the channel uses Enhanced Input instead of the old input mappings.
Still, this older tutorial is valuable because it explains the raw camera logic clearly. If you understand this version, the Enhanced Input version becomes much easier to follow.
Step One: Create the Unreal Engine Project
Start by creating a new Unreal Engine project. A blank project is enough because this tutorial does not rely on a character template. The camera will be controlled through a custom Pawn Blueprint.
Recommended setup:
- Template: Blank
- Project type: Blueprint
- Target platform: Desktop
- Quality preset: Maximum or Scalable, depending on your machine
- Starter content: optional
A blank project is better for understanding because there is less default logic to fight. You are building the camera from scratch, so you know exactly where every input and movement behavior comes from.
Step Two: Set Up Classic Input Mappings
Open:
Edit > Project Settings > Input
This is where you define the classic input bindings for movement, rotation, zoom, and mouse behavior.
Add the following input mappings.
Action Mapping
| Mapping Name | Key | Purpose |
|---|---|---|
| MouseRotationActivate | Middle Mouse Button | Activates mouse drag rotation while held |
Axis Mappings
| Mapping Name | Keys | Purpose |
|---|---|---|
| MoveForward | W = 1, S = -1 | Moves the camera forward and backward |
| MoveRight | D = 1, A = -1 | Moves the camera right and left |
| RotateRTSCamera | E = 1, Q = -1 | Rotates the camera horizontally with keyboard input |
| ZoomRTSCam | Mouse Wheel Axis | Controls camera zoom using the mouse wheel |
| MouseRotate | Mouse X | Reads horizontal mouse movement for yaw rotation |
| MouseRotateUp | Mouse Y | Reads vertical mouse movement for pitch rotation |
| MoveElevation | Z = 1, C = -1 | Optional vertical camera movement |
The reason we separate these mappings is simple: each camera behavior needs its own control path. Movement, zoom, yaw rotation, pitch rotation, and edge scrolling all affect the pawn differently.
Step Three: Create the RTS Camera Pawn
Now create the Blueprint that will act as the actual camera controller.
- Open the Content Drawer.
- Create a folder such as
Main/Blueprints. - Right click and choose Blueprint Class.
- Select Pawn as the parent class.
- Name it
BP_RTSCam.
A Pawn is the correct choice because this camera is not a walking character. It does not need a skeletal mesh, capsule, or Character Movement Component. It only needs controlled movement through the level.
Open BP_RTSCam and add these components:
- Spring Arm
- Camera, attached to the Spring Arm
- Floating Pawn Movement
The Spring Arm gives you distance control, which is perfect for zoom. The Camera gives you the final view. The Floating Pawn Movement component allows the pawn to respond to Add Movement Input.
Step Four: Configure the Spring Arm and Camera
Select the Spring Arm component and set up a top-down angled camera view.
A common starting point:
- Target Arm Length: 600
- Rotation: adjust until you get a clear RTS view
- Pitch: angled downward
- Yaw: depending on your preferred map direction
In the original tutorial, the Spring Arm rotation was set to values around:
X: 180
Y: 105
Z: 180
Depending on your Unreal version and coordinate setup, you may need to tweak these values. The goal is simple: the camera should look down at the map from an angled perspective, not straight from behind or straight from the top.
For RTS games, a slight angle is usually better than a perfectly vertical top-down view because it gives the player depth, terrain readability, and a stronger sense of space.
Step Five: Create Camera Variables
Before building functions, create the variables that control movement, zoom, and rotation behavior.
| Variable | Type | Example Value | Purpose |
|---|---|---|---|
| MovementSpeed | Float | 1200 | Controls how fast the camera moves |
| ZoomSpeed | Float | 40 | Controls how quickly the camera zooms |
| MinZoom | Float | 200 | Closest allowed camera distance |
| MaxZoom | Float | 3000 | Farthest allowed camera distance |
| NewTargetArmLength | Float | 600 | Stores the desired zoom distance |
| CameraRotationSpeed | Float | 4 | Controls keyboard and mouse rotation speed |
| MouseRotationActivated | Boolean | false | Tracks whether middle mouse rotation is active |
Make tuning variables editable where useful. That way, you can test different values in the editor without digging through your Blueprint graph every time.
Step Six: Create the Move Forward Function
Create a custom Blueprint function named:
MoveForward
Add one input:
- AxisValue, type Float
The function should:
- Get the actor forward vector.
- Use Add Movement Input.
- Connect the forward vector to World Direction.
- Connect the input axis value to Scale Value.
If you want additional control, multiply the AxisValue by a speed scalar before applying it, but in many Pawn movement setups, Floating Pawn Movement already handles speed through movement settings.
This function keeps the graph clean. Instead of repeating movement nodes everywhere, you call one reusable function whenever forward movement is needed.
Step Seven: Create the Move Right Function
Create another function named:
MoveRight
Add one input:
- AxisValue, type Float
This function is almost identical to MoveForward, but instead of using the actor forward vector, use:
Get Actor Right Vector
Then connect it into Add Movement Input.
This gives the camera clean side movement. W and S move along the forward axis. A and D move along the right axis.
Step Eight: Connect Movement Input Events
In the Event Graph of BP_RTSCam, add the input axis events:
InputAxis MoveForwardInputAxis MoveRight
Connect:
MoveForwardaxis value to theMoveForwardfunctionMoveRightaxis value to theMoveRightfunction
At this point, if your pawn is possessed correctly and has Floating Pawn Movement, WASD movement should work.
Step Nine: Add Zoom Functionality
Zoom in an RTS camera is usually handled by changing the Spring Arm Target Arm Length. A shorter arm means the camera is closer. A longer arm means the camera is farther away.
Create a function named:
ZoomRTSCamera
Add one input:
- AxisValue, type Float
The zoom logic should:
- Get the current
NewTargetArmLength. - Multiply the input axis by
ZoomSpeed. - Add the result to
NewTargetArmLength. - Clamp the value between
MinZoomandMaxZoom. - Set
NewTargetArmLengthto the clamped result. - Apply it to the Spring Arm Target Arm Length.
You can also smooth the zoom with interpolation. For example, use FInterp To with Delta Seconds to move the actual Spring Arm length toward the desired target length. This makes zoom feel less harsh and more polished.
Connect the InputAxis ZoomRTSCam event to this function.
Why Zoom Needs Clamping
Without clamping, players can zoom too close or too far.
If the camera zooms too close:
- It may clip through the ground or objects.
- The player can lose map awareness.
- The camera angle may become uncomfortable.
If the camera zooms too far:
- The world may become unreadable.
- Performance may drop because more of the map is visible.
- UI scale and selection precision may feel worse.
A good RTS camera always limits zoom range. The exact values depend on your game scale.
Step Ten: Add Keyboard Rotation
Some strategy games allow camera rotation with keyboard keys like Q and E. This is useful when the player wants to rotate around the battlefield without holding the mouse.
Create a function:
RotateRTSCamera
Add one input:
- AxisValue, type Float
The function should:
- Get the actor rotation.
- Break the rotator.
- Add
AxisValue * CameraRotationSpeedto the yaw. - Create a new rotator with the updated yaw.
- Set actor rotation.
This rotates the entire camera pawn. Since the Spring Arm and Camera are children of the pawn, they rotate with it.
Connect InputAxis RotateRTSCamera to this function.
Step Eleven: Add Mouse Rotation Activation
Mouse rotation should not always run. If camera yaw and pitch react to every mouse movement, the camera becomes unusable. Instead, activate mouse rotation only while the player holds the middle mouse button.
Add the action event:
InputAction MouseRotationActivate
Use:
- Pressed: set
MouseRotationActivatedto true - Released: set
MouseRotationActivatedto false
This gives you a simple gate for mouse based camera rotation.
Step Twelve: Add Mouse Yaw Rotation
Add the axis event:
InputAxis MouseRotate
This reads horizontal mouse movement.
The logic should:
- Check if
MouseRotationActivatedis true. - If true, use the mouse axis value to rotate the actor yaw.
- If false, do nothing.
This lets the player hold middle mouse and drag left or right to rotate the camera around the map.
Step Thirteen: Add Mouse Pitch Rotation
Add the axis event:
InputAxis MouseRotateUp
This reads vertical mouse movement.
Unlike yaw, pitch should usually affect the Spring Arm, not the entire pawn. This keeps horizontal movement stable while allowing the camera to tilt up or down.
The pitch logic should:
- Check if
MouseRotationActivatedis true. - Get Spring Arm rotation.
- Break the rotator.
- Add mouse axis value multiplied by rotation speed to pitch.
- Clamp pitch between a safe minimum and maximum.
- Set Spring Arm rotation.
Example pitch clamp:
Minimum Pitch: -80
Maximum Pitch: -1
The purpose of pitch clamping is to stop the camera from flipping, going under the level, or pointing into broken angles.
Step Fourteen: Add Edge Scrolling
Edge scrolling is a classic RTS feature. When the mouse cursor reaches the edges of the screen, the camera moves automatically in that direction.
The logic is based on normalized mouse position:
- Mouse position X divided by viewport width
- Mouse position Y divided by viewport height
This gives values between zero and one.
Edge checks:
- If X is greater than 0.98, move right.
- If X is less than 0.02, move left.
- If Y is greater than 0.98, move backward.
- If Y is less than 0.02, move forward.
This creates a two percent border around the screen. When the cursor enters that zone, the camera scrolls.
How Edge Scrolling Works Internally
Use the Player Controller to get:
- Mouse Position
- Viewport Size
Then divide the mouse coordinates by the viewport dimensions:
NormalizedX = MouseX / ViewportSizeX
NormalizedY = MouseY / ViewportSizeY
These normalized values let the system work across different screen resolutions. A player using 1920 by 1080 and another player using 2560 by 1440 should both get the same edge scroll behavior.
From there, use Branch nodes to compare the normalized values against your edge thresholds. Then call the existing MoveForward and MoveRight functions.
This is why building movement as reusable functions earlier was smart. Edge scrolling can reuse the same movement logic as keyboard input instead of duplicating nodes.
Step Fifteen: Set Input Mode and Lock the Mouse
For edge scrolling, the mouse cursor must stay visible and stay inside the game window. If the cursor leaves the viewport, the edge detection becomes unreliable.
In Event BeginPlay inside your camera pawn or player controller, set up the input mode:
- Get Player Controller.
- Call
Set Input Mode Game and UI. - Set mouse lock mode to lock inside the viewport.
- Set
Show Mouse Cursorto true.
This makes the project feel more like a strategy game because the cursor stays active while camera movement still works.
Step Sixteen: Create the Game Mode
To make Unreal spawn your RTS camera pawn automatically, create a custom Game Mode Blueprint.
- Right click in the Content Drawer.
- Select Blueprint Class.
- Choose GameModeBase.
- Name it
BP_SandboxGameModeorBP_RTSGameMode.
Open the Game Mode Blueprint and set:
- Default Pawn Class:
BP_RTSCam - Player Controller Class: default or your custom controller if you created one
Then assign this Game Mode in:
World Settings > GameMode Override
Now when you press Play, Unreal will spawn and possess the RTS camera pawn instead of a normal character.
Step Seventeen: Test the Full Camera System
After everything is connected, press Play and test each camera feature one by one.
Movement Test
- Press W to move forward.
- Press S to move backward.
- Press A to move left.
- Press D to move right.
Zoom Test
- Scroll the mouse wheel up and down.
- Confirm the camera does not zoom too close or too far.
- Adjust MinZoom, MaxZoom, and ZoomSpeed if needed.
Rotation Test
- Press Q and E to rotate with keyboard input.
- Hold middle mouse and move the mouse left and right.
- Move the mouse up and down to test pitch.
- Confirm pitch clamp prevents camera flipping.
Edge Scrolling Test
- Move the cursor to the right edge of the screen.
- Move the cursor to the left edge.
- Move the cursor to the top and bottom edges.
- Adjust threshold values if the edge zone feels too thin or too large.
Recommended Values to Tune
Every game has a different scale, so do not blindly keep the tutorial values. Tune the camera based on your map size, unit scale, zoom range, and player comfort.
| Setting | Start Value | When to Increase | When to Decrease |
|---|---|---|---|
| MovementSpeed | 1200 | Large maps feel too slow | Small maps feel hard to control |
| ZoomSpeed | 40 | Zoom feels sluggish | Zoom feels too aggressive |
| MinZoom | 200 | Camera gets too close | You need closer tactical inspection |
| MaxZoom | 3000 | Player needs more map overview | Far zoom hurts readability or performance |
| CameraRotationSpeed | 4 | Rotation feels slow | Rotation feels twitchy |
| Edge Threshold | 0.02 and 0.98 | Edge scrolling is hard to trigger | Edge scrolling triggers accidentally |
Common Problems and Fixes
WASD Does Not Move the Camera
Make sure BP_RTSCam has a Floating Pawn Movement component. Also confirm your Game Mode uses BP_RTSCam as the Default Pawn Class and that your Axis Mappings are spelled correctly.
Zoom Does Not Work
Confirm the mouse wheel is assigned to ZoomRTSCam in Axis Mappings. Also check that you are setting the Spring Arm Target Arm Length, not the Camera location directly.
Camera Rotates Too Fast
Lower CameraRotationSpeed. Mouse input can feel much stronger than keyboard input, so you may want separate speed variables for mouse rotation and keyboard rotation.
Camera Flips Upside Down
Your pitch is not clamped correctly. Clamp the Spring Arm pitch to a safe range, such as -80 to -1, depending on your setup.
Edge Scrolling Does Not Trigger
Check that the mouse cursor is visible and locked inside the viewport. Also print the normalized mouse X and Y values to verify they approach 0 and 1 near the screen edges.
Mouse Leaves the Game Window
Use Set Input Mode Game and UI and configure mouse lock mode. If this is not set, edge scrolling becomes unreliable in windowed play mode.
Movement Direction Feels Wrong After Rotation
Make sure movement uses the actor forward and right vectors. If you use world X and Y directly, movement may not follow the rotated camera direction.
Why Reusable Functions Matter
One of the best parts of this setup is separating movement into reusable functions. Instead of wiring movement logic directly from every input event, you create MoveForward and MoveRight once.
That means these same functions can be called from:
- WASD input
- Mouse edge scrolling
- Minimap click movement
- Scripted camera panning
- Cinematic camera movement
- Debug camera controls
This is the kind of thinking that separates a quick prototype from a maintainable system.
When to Use This Camera System
This setup works well for:
- Real time strategy games
- City builders
- Colony simulators
- Management games
- Tower defense games
- Tactical strategy games
- Factory automation games
- Architecture walkthrough tools
- Simulation dashboards
- Editor style in-game tools
It is especially useful when the player needs to observe, command, inspect, and navigate a large space instead of controlling a single character directly.
Older System vs New Enhanced Input Series
This tutorial is still useful, but the newer RTS Camera Series is the better path for modern Unreal Engine projects.
| Feature | Older Tutorial | New RTS Camera Series |
|---|---|---|
| Input system | Classic Action and Axis Mappings | Enhanced Input |
| Learning format | One longer video | Step by step multi-part series |
| Best for | Understanding raw camera logic | Building a cleaner modern project |
| Scalability | Good for prototypes | Better for expandable projects |
If you are starting a new project today, use the newer series. If you want to understand the original camera logic quickly, this older tutorial is still worth reading and watching.
Final Result
After completing this tutorial, your Unreal Engine project will have a playable RTS camera pawn with:
- WASD movement
- Mouse wheel zoom
- Keyboard rotation
- Middle mouse drag rotation
- Pitch control
- Zoom clamping
- Edge scrolling
- Visible locked cursor
- Custom game mode setup
This gives you a practical foundation for strategy game camera controls. From here, you can expand the system with camera boundaries, terrain following, minimap movement, unit selection, drag box selection, formation commands, or cinematic transitions.
Conclusion
A good RTS camera is not just a camera floating above the map. It is the main way the player reads the world, controls strategy, and interacts with the game. Movement, zoom, rotation, and edge scrolling all need to feel predictable and responsive.
This Blueprint system gives you the core foundation. It is not the newest workflow anymore, but it still teaches the logic behind a complete RTS camera. If you want the cleaner modern version, follow the newer Enhanced Input RTS Camera Series on the channel.
Watch the full tutorial: Unreal Engine RTS Camera Setup Smooth Movement And Controls
More Unreal Engine tutorials: rambod.net
Subscribe for more: Rambod Dev on YouTube
Frequently Asked Questions
Is this the newest RTS camera tutorial on the channel?
No. This is an older RTS camera tutorial. There is a newer RTS Camera Series that uses Enhanced Input and explains the system in smaller, cleaner parts.
Should I use this older setup or the newer Enhanced Input version?
Use the newer Enhanced Input version for new projects. Use this older tutorial if you want to understand the original Blueprint logic or maintain an older project that still uses classic input mappings.
Why use a Pawn instead of a Character?
An RTS camera does not need walking, jumping, skeletal animation, or character capsule logic. A Pawn with Floating Pawn Movement is lighter and cleaner for camera control.
Why does zoom use the Spring Arm?
The Spring Arm is designed to control camera distance from a parent actor. Changing Target Arm Length is cleaner than manually moving the camera component.
Why does the camera need edge scrolling?
Edge scrolling is a classic RTS control pattern. It lets the player move the camera by pushing the mouse cursor toward the screen borders, which feels natural in strategy games.
Can I use this camera for city builder or simulation games?
Yes. This system is useful for RTS games, city builders, management games, factory games, simulation tools, and any project that needs a free top-down camera.
Why does my movement not work?
The most common causes are missing Floating Pawn Movement, wrong Game Mode assignment, incorrect input mapping names, or the pawn not being possessed by the player.
Can I add camera boundaries to this setup?
Yes. The newer RTS Camera Series includes a dedicated camera boundaries episode using collision channels and blocking volumes.
Related Tutorials
More lessons connected by category, tags, engine version, or implementation type.
Recommended resource
Recommended for this tutorial
Useful tools selected for this workflow topic.