Part 4 – How To Create Smooth Camera Rotation Controls For RTS In Unreal Engine 5

Part 4 – How To Create Smooth Camera Rotation Controls For RTS In Unreal Engine 5

Published: July 21, 2025 • Series: RTS Camera Series • Level: intermediate

unreal ue5 rts camera blueprints gamedev enhanced input rotation spring arm

This is Rambod, and welcome to Part 4 of the RTS Camera Series.
So far, we’ve built project setup, WASD movement, and smooth zoom. Now we’ll add professional rotation controls with middle mouse drag, pitch/yaw separation, and clamping to keep the camera stable.

By the end, you’ll have a fully functional RTS camera with polished zoom + rotation that feels natural and reliable.


1) Fixing Zoom Direction

Before rotation, let’s refine zoom from Part 3.

  • Open Input Mapping Context.
  • Select your ZoomAction mapping.
  • Add a Negate modifier.

👉 This flips scroll wheel direction so scroll forward zooms in and scroll back zooms out (natural for RTS).


2) Clamping Zoom Distance

Right now, the camera can zoom infinitely in/out. Let’s clamp it.

  1. In BP_RTSPlayer event graph, find the ZoomAction logic.
  2. After Add (Float+Float) → insert Clamp (Float).
    • Min = 20 (prevent zooming inside the pawn).
    • Max = 1000 (set maximum zoom distance).
  3. Plug Clamp output → Set Target Arm Length.

✅ Now your zoom system has boundaries and feels polished.


3) Create the Rotation Input Action

  1. In Input/Actions, create a new Input Action named IA_RotationAction.
  2. Open it → set Value Type = Axis2D (Vector2D).
  3. Save & close.

This gives us a 2D vector for handling both mouse X and Y movement.


4) Add Input Mapping for Mouse Drag

Open your Input Mapping Context.

  • Add a mapping for IA_RotationAction.
  • Add two triggers:
    • Mouse Y → controls pitch (up/down).
    • Mouse X → controls yaw (left/right).

Apply Modifiers

  • Both mappings need:
    • Swizzle Input Axis Values
    • Negate

For Mouse Y:

  • Swizzle → YXZ

For Mouse X:

  • Swizzle → XZY

👉 Swizzling ensures axes map correctly. If skipped, rotation directions will feel inverted or broken.


5) Add Rotation Activation Variable

We don’t want constant rotation — only while holding the Middle Mouse Button (MMB).

  • In BP_RTSPlayer, create a new variable:
    • Name: RotationActivate
    • Type: Boolean
    • Default: false

6) Middle Mouse Activation

  • In the Event Graph, add Middle Mouse Button Input.
    • On Pressed → Set RotationActivate = true.
    • On Released → Set RotationActivate = false.

✅ Camera rotation is now tied to MMB drag.


7) Blueprint Rotation Logic

Step A – Setup Branch

  1. Right-click → add IA_RotationAction event.
  2. Drag off Triggered Exec Pin → connect to a Branch.
  3. For condition → drag in RotationActivate variable → Get → wire into branch.

👉 Only executes if MMB is held.


Step B – Split Input

  • From Action Value → add Break Vector2D.
    • X = Mouse horizontal movement.
    • Y = Mouse vertical movement.

Step C – Pitch (Up/Down Tilt)

  1. Drag in SpringArm component.
  2. Get Target Rotation → Break Rotator.
  3. From Pitch output:
    • Add + Y (from Break Vector2D).
    • Clamp Float → Min = -80, Max = -10.
  4. Make Rotator:
    • Pitch = clamped value.
    • Yaw = old Yaw.
    • Roll = 0.
  5. Set World Rotation on SpringArm.

✅ Camera now tilts up/down smoothly with limits.


Step D – Yaw (Left/Right Rotation)

  1. Get Actor Rotation (Self).
  2. Break Rotator.
  3. From Yaw output:
    • Add + X (from Break Vector2D).
    • Clamp Float → Min = -360, Max = 360.
  4. Make Rotator:
    • Yaw = clamped value.
    • Pitch = old Pitch.
    • Roll = 0.
  5. Set Actor Rotation on Self.

✅ Camera rotates left/right cleanly, independent of pitch.


8) Test & Polish

  • Play the level.
  • Hold MMB → move mouse:
    • Up/Down → Pitch (SpringArm tilt).
    • Left/Right → Yaw (Actor rotation).
  • Zoom now works with correct direction + limits.

Adjustments

  • Clamp ranges → widen/narrow tilt limits.
  • Sensitivity → scale Action Value before applying.

9) Subtitle Expansion (Full Flow)

“In this part, we add smooth RTS camera rotation. First, fix zoom by adding a Negate modifier and clamping arm length between 20 and 1000. Next, create a new Input Action for rotation (Axis2D), and bind Mouse X/Y with swizzle + negate modifiers. Inside BP_RTSPlayer, add a RotationActivate boolean and toggle it with middle mouse pressed/released. For logic, branch on RotationActivate, break the Vector2D, and split pitch vs yaw. Pitch is handled by SpringArm rotation with clamp from -80 to -10. Yaw is handled by actor rotation with clamp from -360 to 360. When tested, holding middle mouse drag rotates the camera smoothly without flips or weird angles. This finalizes rotation setup, making the RTS camera system professional and responsive.”


10) Wrap-Up

In Part 4, we:

  • Fixed zoom direction (Negate)
  • Clamped zoom distance
  • Created a Rotation Input Action (Axis2D)
  • Added middle mouse activation for rotation
  • Separated Pitch (SpringArm) vs Yaw (Actor)
  • Clamped ranges to prevent flips
  • Tested smooth, professional RTS rotation

👉 Next part: expanding controls with edge scrolling and polish.

📦 GitHub: UE5 RTS Camera Tutorial
📚 Docs: Spring Arm Docs
💬 Discord: Join the Dev Community
🌍 More info: Rambod.net RTS Camera