How to rotate camera 180 degrees when it is above the player and goes beyond it

The camera rotates when the player holds the mouse button and moves it around. I also wanted the camera to smoothly interpolate. So this is the code that does that.

Now what I want is the camera to flip 180 degrees when it is directly above the player. Otherwise the camera would show the world upside down. I tried to implement in Blueprints but failed. This is what I have right now. The camera weirdly snaps to some arbitrary rotation when it crosses the 90 degree mark.

Rot_1-ezgif.com-video-to-gif-converter

[SOLVED]

This bit of code did the job. Although it was pretty easy but I couldn’t wrap my head around it.

This is the result. The camera would now rotate if the player hits the clamped value.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.