How to constrain camera/controller rotation?

Hey Dmitry,

So first you will want to turn off “Use Controller Rotation”, next we are going to need to go into the eventgraph and tell the BP to clamp the camera rotation.

I have added an image that you can reference while following along with this mini-tutorial:

The simplest way to do this in the 3rd Person template is to start by getting the Camera Boom, then dragging off to get Transform > Relative Rotation. Break the relative rotation, so you can get Pitch and Yaw. Drag the two InputAxis events out into Add Float nodes. Add your Pitch from Break Rotator to your InputAxis LookUp. Add your Yaw to your InputAxis Turn. Separately Clamp both Add’s outputs. In the Clamps, you can set the angle to which you can rotate your camera. Drag off a Clamp and create a Make Rot node. Plug your Pitch clamp and Yaw clamp into their respective nodes. Add an Event Receive Tick. Drag off the execution and create a Set Relative Actor Location. Plug your Make Rot output into the New Rotation and your Camera Boom into Target.

In the image you may notice the InputAxis LookUp multiplies by -1 before adding. That will change it from inverted looking to standard. You can also see what my clamp Min and Max are; With that setup the camera can lean up and down slightly and turn to see a profile view on the character. Please let me know if you have any other questions.

Thank you,

Alexander

3 Likes