Search code examples
libgdx

how can i get my orthographic camera view 's height and width in LibGDX?


I have a orthographic camera that is set to my box2d world, and I need to get the camera's view width and height, how can I do that?


Solution

  • Just use Camera's viewportWidth and viewportHeight properties1. I.e.:

    float width = camera.viewportWidth;
    float height = camera.viewportHeight;