# Issue clamping pitch/yaw of camera

**URL:** <https://forums.unrealengine.com/t/issue-clamping-pitch-yaw-of-camera/491589>\
**Category:** Cinematics & Media\
**Tags:** rotation, unreal-engine, clamp, Blueprint, question\
**Created:** [December 4, 2021, 2:52am UTC](https://forums.unrealengine.com/t/issue-clamping-pitch-yaw-of-camera/491589 "2021-12-04T02:52:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vexe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vexe](https://forums.unrealengine.com/u/vexe)\
**Post date:** [December 4, 2021, 2:52am UTC](https://forums.unrealengine.com/t/issue-clamping-pitch-yaw-of-camera/491589/1 "2021-12-04T02:52:14Z")

</div>

Hi there,

so I have a static camera tracking the player moving around.

I’m trying to put a limit on how much the camera can track the player on pitch/yaw.

This is what I have so far (this is a blueprint of my custom camera, inherited from CameraActor):

 ![353510-untitled.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/4/0/f405f756f78de03da563c314996b8cb63c95a09e.png)

Which seems to work-ish. The problem happens when the yaw reaches clamped min/max bounds, the pitch starts to go higher in value for some reason. Bit hard to explain, so I made a little video: [CLICK HERE][2].

Notice how I have a clamp of 10 degrees, as soon as I go above or below that on the yaw the pitch goes up. If I adjust the clamp to 45 degrees, everything is fine within that range, but same thing as soon as I hit the limit the pitch goes up.

What I expect is the pitch to not move at all, if the look at rotation reaches the clamped bounds, it should just not rotate.

I’m not sure if I’m missing something like if angle \> 180, subtract 360. I tried that, didn’t do much.

(Note that StartRot is just the initial rotation of the camera)

What am I missing?  
Thanks for your help!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 4, 2021, 9:19am UTC](https://forums.unrealengine.com/t/issue-clamping-pitch-yaw-of-camera/491589/2 "2021-12-04T09:19:29Z")

</div>

Have you tried removing this?

![353531-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/4/2/142a52482fa053a69ba56f552f8da06c61d1eec9.jpeg)

You have to totally exclude roll, or use it.

---

<div class="post-metadata">

**Author:** ![vexe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vexe](https://forums.unrealengine.com/u/vexe)\
**Post date:** [December 4, 2021, 3:27pm UTC](https://forums.unrealengine.com/t/issue-clamping-pitch-yaw-of-camera/491589/3 "2021-12-04T15:27:50Z")

</div>

Hi, I tried clamping roll, and ignoring it (leaving it at 0), and hooking it up to the start roll, and using it directly from the look at, none made any difference…

---

<div class="post-metadata">

**Author:** ![vexe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vexe](https://forums.unrealengine.com/u/vexe)\
**Post date:** [December 4, 2021, 6:10pm UTC](https://forums.unrealengine.com/t/issue-clamping-pitch-yaw-of-camera/491589/4 "2021-12-04T18:10:41Z")

</div>

So I don’t think this is a bug, looking at it more, its just that the camera is at a bit of an angle, so when the player goes to its left or right, the pitch has to adjust to look up at him. If I unclamp the Yaw, the pitch still happens, its just that when we combine the Yaw and Pitch rotation, it looks correct, but when the Yaw is clamped and the Pitch moves, it looks ‘off’ giving the impression that its doing the wrong thing… If I’m wrong please correct me.

One thing I thought I could do is if if the Yaw is clamped, don’t adjust the pitch anymore, whish seems to work good. Like so:

 ![353547-untitled.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/c/d6c965df5b80c85504ef36af1f85547d349f9253.png)
