- Home /
Polygons clipping at edge of screen
I'm making a 2d game with an orthographic camera. When objects are right at the edge of the screen they clip out... i.e. they disappear before they have gone completely off screen and it doesn't look that great. I'm not doing it in code and i can't really see where it's set up in Unity. Anybody got a clue for me???
thanks :)
Note - you can actually set the clipping plane of an ortho camera to a negative value. Seems strange, but this is normal and usually needed.
That's typically the solution: turning off culling is usually not actually relevant, surprisingly.
Ah thanks - that sounds likely - i procedurally create them all and set up the vertices so i bet i'm making a mistake there...
Answer by Philipp · Feb 15, 2013 at 11:51 AM
Depending on how your objects are set up, one possible problem could be that your objects' bounding boxes aren't set up correctly. Unity's camera culling depends on the meshes' bounding volumes, which aren't automatically updated, if you change a mesh's vertices. If you're using procedurally created geometry, make sure you're calling mesh.RecalculateBounds().
If you're just setting up imported objects in Unity without accessing them via code, your issue is probably somewhere else.
For imported objects it's also possible that the bounds get corrupted. You may setup those in inspector - select object's mesh and edit "Bounds->Center/Extents".
Thank you! I've been having this exact problem with a mesh I am generating in code and couldn't figure out what was going on. Using RecalculateBounds() worked perfectly!
Your answer
Follow this Question
Related Questions
Finding the right ortho size to fill the screen with an object 1 Answer
How to letterbox the screen and have pixel perfection in a 2d game 0 Answers
2D Game. Screen, Camera and coordinates. 0 Answers
Top-Down 2D game:How to make the camera move on hitting the sides of the screen? 2 Answers
Fixing the camera's left side in a 2D Game in all screen resolutions 0 Answers