Hi,
I have restricted movement of the camera in RTS like game with Mathf.Clamp:
Vector3 p = camera.transform.position;
camera.transform.position = new Vector3(Mathf.Clamp(p.x, minBoundX, maxBoundX),
p.y,
Mathf.Clamp(p.z, minBoundZ, maxBoundZ));
But there is rotation (camera.transform.RotateAround(rotationCenter, Vector3.up, GetMouseAxis.x * rotationSpeed / Time.timeScale * Time.deltaTime))
and after rotation there is posibility that camera is out of bounds - it need to be that way, because I don’t want to block rotation.
After this situation, when start move camera, Mathf.Clamp makes “jump” to the min/maxBound.
Could anyone advice any solution to this?