How to set max and min yaw for camera/player rotation

Hey,
I’m looking for way to compare player contol rotation with my custom rotator value.
I’m trying to set max and min yaw camera value in my game (static turret)

4 Likes

There are a few ways to limit Camera or Player rotation.

In Blueprints , you can make use of the Camera Manager:

Another way would be to create a custom “Camera Manager” Class : Easy way(Open the Player Controller , and create one under Defaults)

And under the Defaults of the new created Camera Manager Class , you have access to the rotation limits.

Ockert.

4 Likes

Thanks so much, Ockertvs! Your solution worked perfectly. I really appreciate you taking the time to answer the poster’s question as it has helped others, too! :slight_smile:

1 Like

Hello

I d like to set my yaw depending of the character forward vector and not world rotation.

It s a FPS and i m doing a climbing feature so i want to lock my yaw but the camera manager set it depending to the world.

I can t find anything about it on google…

Thanks

1 Like

hey, I’m totally new to EU and I’m doing an FPS with a climbing feature too !
so I did this with a lot of research, and it works pretty well.

ps : the link to the left comes from envent tick

I hope I was helpful :smiley:

1 Like

I solved it, if u needs help, message me!

1 Like

For anyone looking into this, another solution could be setting dynamically the min and max yaw inside the player camera manager.

  • Create a custom Player Camera Manager

  • Get a refence to the character on the begin play (no need to cast to a specific character)

  • In the tick event of the camera manager get the actor rotation and set View Yaw Min and View Yaw Max subtracted or added with you’re value, in the example the Yaw is limited to 90 degrees to the left and 90 degrees to the right from the current rotation of the character.

3 Likes

This doest work for me, depending on how my climbing thing is rotated the camera will be facing either up or towards the climbing thing :frowning:

1 Like

This helped me out so much! I wanted to limit the range of motion of the camera of my player only when “hidden” in a closet, after leaving I just reset the values to what they were on game start. Thanks!

1 Like

Another solution to set max and min yaws from character rotation, not world

Adjust “FirstPersonYawAngle” to the angle you want to limit

If you want to go back to normal set the variable to the default:
ViewYawMin = -89.900002
ViewYawMax = 89.900002

Hope it helps (¬‿¬)


1 Like