Download

How to Limit camera rotation for player pawn that can walk on walls / ceiling as if its the ground?

Heyho, I’m currently trying to figure out how I can limit the camera rotation for looking up and down on my player pawn. I’m not using the controller rotations (my prototype is not working when i do so :frowning: ), so I can’t just limit the values there via CameraManager.

Here is the current Blueprint for the camera: Camera posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4

My problem is, I’m using a custom movement, made in blueprints and my player pawn can walk on the ceiling / walls / slopes and the first person perspective is rotated so it looks to the player like the pawn is always walking on the ground.

Currently, when I move my mouse up and down the camera rotates accordingly, but is not limited, which results in the perspective being upside down with inversed controlls when the player rotates the camera too far.

I would like to limit it, so the player can max rotate the camera to look directly up or down, depending on his current perspective. My problem is, depending on the current “ground” of the player, I would have to limit either pitch / yaw / roll or a combination of them, since I’m not limiting the player to certain directions.

Nevermind, found a solution myself.
Maybe not the best, but it works as intended. In case anyone else searches for such a solution, here’s how I did it: