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:
“View yaw max and view min”. It is limit yaw of the world, not my character
“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.
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?
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.
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
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.
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
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.
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.
Rotate character with mouse and fix camera behind it?
Or
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.