# Camera flipping on rotation issue

**URL:** <https://forums.unrealengine.com/t/camera-flipping-on-rotation-issue/410596>\
**Category:** Cinematics & Media\
**Tags:** springarm, unreal-engine, Blueprint, question\
**Created:** [November 25, 2017, 9:21pm UTC](https://forums.unrealengine.com/t/camera-flipping-on-rotation-issue/410596 "2017-11-25T21:21:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuelb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Samuelb](https://forums.unrealengine.com/u/Samuelb)\
**Post date:** [November 25, 2017, 9:21pm UTC](https://forums.unrealengine.com/t/camera-flipping-on-rotation-issue/410596/1 "2017-11-25T21:21:14Z")

</div>

Hey there, I had a similar question related to this issue, But this was a more specific problem.

\*\*What I’m doing: \*\*  
I’ve got an Actor blueprint which has a SpringArm and camera attached to it. I’m Rotating and setting its location to be at the center of both (2) players.

\*\*The Issue: \*\*  
When the Cameras actor rotation reaches a 90 or -90 degrees, the camera suddenly does a 180 flip.  
\*\*Video Showing the issue: \*\* [CameraRotation problem - YouTube](https://youtu.be/jS8ntx04RNw)

How can i get rid of this unwanted behaviour?

Thanks in advance!  
-SamuelB

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [November 26, 2017, 4:49pm UTC](https://forums.unrealengine.com/t/camera-flipping-on-rotation-issue/410596/2 "2017-11-26T16:49:12Z")

</div>

I think there is a problem in using FindLookAt results, but this is really not a point.

For now you need to understand a logic of this camera setup.

Two characters can be on right and left side of a camera.  
For example, P1 on right and P2 on left. SpringArm location will be:

```
(P1.location + P2.location)*0.5

```

Rotation can be calculated according to character’s sides.

```
RightVector = P1.location - P2.location
CameraYAxis = Normalize(Vector(RightVector.x, RightVector.y, 0)
MakeRotFromY(CameraYAxis)

```

But here is one problem. What should happen if characters change sides? When P1 make some big jump and pass location of P2. In this case, with this math, camera will flip. Maybe not instant flip, but it will.

So… Camera rotation should depend on some right and left side, but it shouldn’t depend on which character is on that side.

---

<div class="post-metadata">

**Author:** ![Samuelb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Samuelb](https://forums.unrealengine.com/u/Samuelb)\
**Post date:** [November 26, 2017, 6:52pm UTC](https://forums.unrealengine.com/t/camera-flipping-on-rotation-issue/410596/3 "2017-11-26T18:52:15Z")

</div>

Hey, thank you redbox again for the answer. I’ll give this a try and report back later.

-SamuelB

---

<div class="post-metadata">

**Author:** ![Samuelb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Samuelb](https://forums.unrealengine.com/u/Samuelb)\
**Post date:** [November 27, 2017, 12:13pm UTC](https://forums.unrealengine.com/t/camera-flipping-on-rotation-issue/410596/4 "2017-11-27T12:13:16Z")

</div>

I Finally got it working! I Used the math you presented to get the correct answer, thank you so much =)!

Here is the final solution in blueprints.

 ![221634-sharedcamrotation.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/c/47c19c9e56f58534798918c1a2d201018843d289.png)

-SamuelB
