Look rotation restriction

atmuc

Member
How can I restrict look rotation?

Assume that I have a player on a tower. I want this player to aim to a limited area.

I restricted position. I cannot restrict rotation with "restrict rotation" ability. I think this ability just for the character not for aiming.
 
As you've realised, the Restrict Rotation ability is for restricting the rotation of the character, not the camera.

To restrict the rotation of the camera, you should create a custom View Type (you can inherit from whichever view type you are currently using to copy its behaviour), and add code to the end of its Rotate function to clamp the camera's angle.
 
As you've realised, the Restrict Rotation ability is for restricting the rotation of the character, not the camera.

To restrict the rotation of the camera, you should create a custom View Type (you can inherit from whichever view type you are currently using to copy its behaviour), and add code to the end of its Rotate function to clamp the camera's angle.
I cloned First Person Combat View. I confused what to limit. First person view and locomotion controller rotates character. Should I try to limit something before or after base.Rotate(horizontalMovement, verticalMovement, immediatePosition); ?
 
I would say after base.Rotate, you could clamp the camera's Y rotation to within a certain range.
 
As I see limiting just the camera is not enough, because the character goes on rotating. so I should limit the rotation of the character too. Restrict rotation ability is like quantizing rotation. UCC is very flexible, that makes it a little bit complicated :)
 
Top