Let’s look at an easier method how to limit the camera rotation in Unreal Engine without using a single math node.
We’ll need to create a blueprint class of the PlayerCameraManager type and hook it up to our PlayerController, which we should be specified in the GameMode.
Create and set up Camera Manager
Here’s what you need to do to create it:
- Right-click an empty space in your Content Browser, and select Blueprint Class from the context menu.
- In the pop-up window that opens, expand All Classes at the bottom and search for PlayerCameraManager, then select it and click the Select button.
- Name your new blueprint accordingly — for example,
BP_CameraManager
— and open it. - In the top panel, click Class Defaults. You might need to click Open Full Blueprint Editor link at the top first.
- In the Details panel on the right, find fields that we’re looking for —
View Pitch Min
,View Pitch Max
and the respective fields for Yaw and Roll. - Adjust the values to your liking.
- Compile and Save.
Tie everything together
Now that you’ve created the blueprint class that’s responsible for limiting the camera angles, let’s hook everything up so that it actually affects the gameplay.
- Open your GameMode and make sure that there’s your custom PlayerController specified in it.
- Open your PlayerController and specify your
BP_CameraManager
as the Player Camera Manager Class — this should be the topmost option.
And that’s basically how you limit the camera rotation in Unreal Engine. If you’ve set up everything correctly, your camera should not move beyond the limits that you’ve set up in the camera manager class.
Why not see how Jump higher on longer jump key press now?