How to limited camera yaw for character rotation?

Hello, are there any methods to deal with the problem:
I want to limited my camera yaw for my character between -135 ~ 135

There are methods I had tried:

  1. “View yaw max and view min”. It is limit yaw of the world, not my character

  2. “Add relative rotation”. I had saw some people in answerhub used it, I used it with “inrange(float)”, but when value achieve 135 or -135, character can’t move anymore.

I had search information a few days but still can’t deal with it. It would thankful if someone can give me some suggestions, thank you.

1 Like

Oh thanks, I think it is worth to try, i will check it.

Did you tried to use custom PlayerCameraManager class? It contains such setttings for camera rotation limitations. But I’m not sure this is what you are looking for. Anyway, create PlayerCameraManager, specify rotation limits, and set this class to your PlayerController.

Hi, I had check your method, it still only limit yaw in world rotation, but still thanks, and I had seen someone in answerhub said if take rotation graph into “custom player controller”, it can be limit yaw in pawn. Did you know something abou that?

Oh great, thanks, I will try it.

Pawn rotation uses controller’s ControlRotation, so you can get it, set its limits by simple per component clamp, set. But this rotation is in world coordinates.

yep, I will check it, thank you so much

Hi, can I see your “pawn” setting or component tab? Has anything I need to setting with the scene component, I am still search for it. Thanks.
And my rotation is add in character class

A character is basically a pawn. My “pawn” is not a normal pawn itself but a pawn that in a ChildActor.

Don’t confuse yourself with “pawn” node. The way I show you for limiting RelativeRotations.

You can add/set RelativeRotation for your character’s CapsuleComponent.

Got it, thanks a lot, but now the camera can’t move anymore, seems your method is focus on pawn rotation right? Actually I want to limit the camera view, So Is it possible to limit the “camera rotation(not world rotation)” in a similar way?

You can rotate limited with this almost on everything. Actor, Pawn, Component etc.

If you want to rotate camera only, you can use same idea on Camera components as well.
Or you can use SpringArm as parent of Camera and Add/Set RelativeRotation to SpringArm for 3rd person camera movement. You can search for that on Google. Very easy to implement.

Ok, I think I should search some information, thanks.

Hi, it’s me again. After research, I had made those graph, but the view just can’t move anymore, and values from “print string” are correct. am I missing something? And I had “aim off” graph, will the problem in there?

Those are some of my graph:
Character class blueprint event graph


animation blueprint event graph

I think you should delete EventTick’s execution pin from AddRelativeRotation’s for a start. If problem continues, you should create a new fresh character class and check if same Add/Set RelativeRotation is working well.

Note: Check if you get same results in PlayInEditor and StandaloneGame.

Yes, that make sense, I forgot to create a new class for test, I will try and see what I get, thanks.

hi, it is work in my new empty graph, but the limit rotation still in world rotation, it shows like the character can only face on one direction.

actually I want the limit yaw in every direction. I had tried other solution in a few days, but still no idea, would you give me some suggestion? Thanks.

So you want to;

Rotate character with mouse and fix camera behind it?


Rotate character with keyboard WASD and rotate camera with MouseX/Y?

I am not sure I understand what you want to achieve exactly.
And are you sure Add/Set RelativeRotation causes WorldRotation? I didn’t understand how this could happen either.

seems i have not explain clear enough, so i make a video to try to explain it, hope that can help.

So you want to do first one;
Locking the Camera on Character and limiting Character’s rotation instead of Camera’s.

I tried everything I can with AddYawInput or AddControllerYawInput.
But I couldn’t succeed. And then, I changed way of implementing.

Use [VictoryPlugin by Rama][1] and you will see how easy is this:

Really thank you, i will try it once I back to my computer