Limit camera rotation in Unreal Engine featured image

Lim­it cam­era rota­tion in Unre­al Engine: pitch, yaw and roll

Let’s look at an eas­i­er method how to lim­it the cam­era rota­tion in Unre­al Engine with­out using a sin­gle math node.

We’ll need to cre­ate a blue­print class of the Play­er­Cam­era­Man­ag­er type and hook it up to our Play­er­Con­troller, which we should be spec­i­fied in the GameMode.

Cre­ate and set up Cam­era Manager

Here’s what you need to do to cre­ate it:

  1. Right-click an emp­ty space in your Con­tent Brows­er, and select Blue­print Class from the con­text menu.
  2. In the pop-up win­dow that opens, expand All Class­es at the bot­tom and search for Play­er­Cam­era­Man­ag­er, then select it and click the Select button.
Creating PlayerCameraManager that helps to limit camera rotation in Unreal Engine
  1. Name your new blue­print accord­ing­ly — for exam­ple, BP_CameraManager — and open it.
  2. In the top pan­el, click Class Defaults. You might need to click Open Full Blue­print Edi­tor link at the top first.
  3. In the Details pan­el on the right, find fields that we’re look­ing for — View Pitch Min, View Pitch Max and the respec­tive fields for Yaw and Roll.
  4. Adjust the val­ues to your liking.
  5. Com­pile and Save.

Tie every­thing together

Now that you’ve cre­at­ed the blue­print class that’s respon­si­ble for lim­it­ing the cam­era angles, let’s hook every­thing up so that it actu­al­ly affects the gameplay.

  1. Open your GameM­o­de and make sure that there’s your cus­tom Play­er­Con­troller spec­i­fied in it.
  2. Open your Play­er­Con­troller and spec­i­fy your BP_CameraManager as the Play­er Cam­era Man­ag­er Class — this should be the top­most option.

And that’s basi­cal­ly how you lim­it the cam­era rota­tion in Unre­al Engine. If you’ve set up every­thing cor­rect­ly, your cam­era should not move beyond the lim­its that you’ve set up in the cam­era man­ag­er class.

Why not see how Jump high­er on longer jump key press now?