Unreal Engine RTS Camera Setup: Smooth Movement & Controls

Unreal Engine RTS Camera Setup: Smooth Movement & Controls

Published: January 24, 2025 • Series: RTS Camera • Level: beginner

unreal ue5 rts camera blueprints

This is Rambod and today we create a complete RTS camera system in Unreal Engine 5. You will learn how to set up smooth movement, zoom, rotation, and edge-scrolling controls — the essentials for any strategy or simulation game.

1) Project setup

  • Start with a blank Unreal Engine template (Blueprint or C++ both work).
  • Go to Project Settings → Input.
  • Create the following input mappings:
    • Action Mapping: MouseRotationActivate → Middle Mouse Button.
    • Axis Mapping: MoveForward → W (1), S (-1).
    • Axis Mapping: MoveRight → D (1), A (-1).
    • Axis Mapping: RotateRTSCamera → E (1), Q (-1).
    • Axis Mapping: ZoomRTSCam → Mouse Wheel Axis.
    • Axis Mapping: MouseRotate → Mouse X.
    • Axis Mapping: MouseRotateUp → Mouse Y.
    • Axis Mapping: MoveElevation → Z (1), C (-1) (for optional vertical movement).

2) Create the RTS camera pawn

  • In the Content Drawer, create a new folder Main/Blueprints.
  • Right click → Blueprint Class → Pawn.
  • Name it BP_RTSCam.
  • Add two components:
    • Spring Arm (Target Arm Length = 600, Rotation ~ X:180, Y:105, Z:180).
    • Camera (child of the spring arm).

This creates the base of the RTS camera.

3) Movement functions

Create custom functions inside BP_RTSCam:

Move Forward

  • Input: Axis Value (float).
  • Multiply by MovementSpeed variable.
  • Use Add Movement Input with actor forward vector.

Move Right

  • Input: Axis Value (float).
  • Multiply by MovementSpeed.
  • Use Add Movement Input with actor right vector.

Set default MovementSpeed (e.g., 1200).

4) Zoom functionality

  • Create variables: NewTargetArmLength, ZoomSpeed, MaxZoom, MinZoom.
  • Default values: Min=200, Max=3000, ZoomSpeed=40.
  • In ZoomRTSCamera function:
    • Multiply ZoomSpeed * AxisValue.
    • Add to NewTargetArmLength.
    • Clamp between MinZoom and MaxZoom.
    • Use FInterpTo with Delta Seconds for smooth transition.
    • Update Spring Arm Target Arm Length.

5) Rotation functions

Rotate RTS Camera (Yaw)

  • Input: Axis Value.
  • Multiply by CameraRotationSpeed (default = 4).
  • Add to actor’s yaw and clamp between -360 and 360.

Rotate RTS Camera Up/Down (Pitch)

  • Input: Axis Value.
  • Multiply by CameraRotationSpeed.
  • Get Spring Arm rotation.
  • Add to Pitch, clamp between -80 and -1 (prevents clipping).
  • Set Spring Arm world rotation.

6) Edge scrolling

  • Get Player Controller → Mouse Position and Viewport Size.
  • Divide mouse position by viewport size to normalize (0 to 1).
  • If X > 0.98 → move right. If X < 0.02 → move left.
  • If Y > 0.98 → move backward. If Y < 0.02 → move forward.
  • This mimics traditional RTS-style border scrolling.

7) Input logic

  • In Event Graph, wire up:
    • MoveForward → MoveForward function.
    • MoveRight → MoveRight function.
    • ZoomRTSCam → ZoomRTSCamera.
    • RotateRTSCamera → Rotate function.
  • Add MouseRotationActivate (Boolean) to enable rotation with Middle Mouse.
  • Add Mouse X/Y inputs for rotation while held.

8) Input mode and game mode

  • In Begin Play:
    • Get Player Controller.
    • Set Input Mode: Game and UI.
    • Lock mouse input and enable cursor visibility.
  • Add a Floating Pawn Movement component for smooth control.
  • Create a Game Mode Blueprint (e.g., BP_SandboxGameMode).
    • Set Default Pawn to BP_RTSCam.
    • Apply this game mode in World Settings.

9) Test and refine

  • Save and compile.
  • Drag into your level.
  • Test WASD movement, zoom, rotation, and edge scrolling.
  • Adjust Min/Max zoom, rotation clamp, and speed to taste.

Wrap up

You now have a fully functional RTS camera system in Unreal Engine 5 with smooth movement, zoom, rotation, and edge scrolling. This is a great foundation for any strategy or simulation project.

For more tutorials and resources, visit rambod.net, subscribe on YouTube, or watch this tutorial here: Watch on YouTube.