- Home /
Camera Boundry when changing orthographic size
Hello Again. I would love to know to decide Camera boundry when Changing orthographic size. E.g When orthographic size equals to 5 the bounds lets say left =-20 right =0 top =0 and bottom =-10. But when i change orthographic size to lets say 3 the bounds will be left =-24 right =4 top =1.6 and bottom =-12. is there a way to solve it? In short i want to decide a position and even if i change the orthographic size i dont want my camera exceed that position.
float value = Camera.main.orthographicSize;
if (value<=2)
{
Leftpos.x = Mathf.Clamp(Leftpos.x, -26, 6.5f);
}
if (value>=2&value<=3)
{
Leftpos.x = Mathf.Clamp(Leftpos.x, -22, 4.5f);
}
if (value >= 3 & value <= 4)
{
Leftpos.x = Mathf.Clamp(Leftpos.x, -21, 2.5f);
}
i tried to fix with the codes above but it will be long and not convenient.
Your answer
Follow this Question
Related Questions
Unity 5.2 camera not recognised 1 Answer
Switching camera to follow object 0 Answers
How to access camera preview frames with MediaCapture Class in Unity? 0 Answers
Rotating Player with Mouse 0 Answers
Enabeling components 1 Answer