I am on implementing the player camera. I have implemented so far the vertical rotation restriction, so that the player cannot rotate his head 360 °. This works perfectly. Now for a specific case I need to do also a restriction on the horizontal axis, so that the player cannot move the head/camera left or right at all. I used the same approach as for the vertical rotation, but this time it doesn’t work. And I am not seeing the error there. Can somebody pls help? What am I doing wrong?
Try putting the code in a formatted way instead of a screenshot , it’s already text so just copy/paste.
Maybe it’s because you’re claming the value to 0 ? in the line Mathf.Clamp(yRotation , 0,0,)
Hello, so I have figured out, that I actually should not restrict the camera, but the whole player. Because when I am rotating left / right, then I am rotating the whole player, not just the camera. Sorry, my bad. Huxi