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

Build RTS camera rotation in UE5.6 using Enhanced Input, mouse drag, clamped pitch/yaw, and polished zoom. Professional strategy-style camera controls.

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.

👉 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.

Apply Modifiers

For Mouse Y:

For Mouse X:

👉 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).


6) Middle Mouse Activation

✅ 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


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

Adjustments


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:

👉 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

Code