So i have a simple character controller but i want to clamp the camera so that i cant turn 180 degree vertically. As far as i know my code should have worked.
The values i want it to clamp by are min-70 and max70. But whenever i enter those as Min and Max nothing changes. This is my current code
float x = Mathf.Clamp(_joystick.Vertical * (_moveSpeed * Time.deltaTime), camMin, camMax);
myCamera.transform.eulerAngles -= new Vector3(x, 0);
I feel like im missing something by now but i am unable to find what. So any help would be appreciated :D
You are only clamping the change in angle, not the actual angle. You should do something like: