Answer the question
In order to leave comments, you need to log in
How to set correct camera borders?
Recently I tried cinema machine, but it has flaws at least for my movement option, in general I returned with the standard camera movement and focus adjustment.
The problem is only with the indication of boundaries, I have movement in 2D in all directions plus focus, the boundaries are set by a 2D collider
float BoundSizeX = LevelPrefab.gameObject.GetComponent<BoxCollider2D>().size.x;
float BoundSizeY = LevelPrefab.gameObject.GetComponent<BoxCollider2D>().size.y;
float BoundOffsetX = LevelPrefab.gameObject.GetComponent<BoxCollider2D>().offset.x;
float BoundOffsetY = LevelPrefab.gameObject.GetComponent<BoxCollider2D>().offset.y;
float maxY = BoundOffsetY + (BoundSizeY / 2f);
float minY = BoundOffsetY - (BoundSizeY / 2f);
float minX = BoundOffsetX - (BoundSizeX / 2f);
float maxX = BoundOffsetX + (BoundSizeX / 2f);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question