0
\$\begingroup\$

I am confused . what shall I set the orthographic camera viewport in libGDX when I use box2d , in one tutorial I saw that he divided his viewport numbers to 32 because 1meter =32 pixel , but I think it will make the images to be displayed by lower quality , so can anybody explain me what viewport shall I set ?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

I think you need to find the needed ratio between Texture size and meters. I would probably use 100px:1m. Then, when you are setting the fixture sizes, multiply the texture size with the ratio.

Try something like this:

//RATIO private float ratio = 1/100; // TEXTURE private Texture texture = new Texture(YOUR TEXTURE PATH); private float fixtureHeight = texture.getHeight() * ratio; 

So now, if your player will be 200px heigh, then ,in box2d, it will be 2 meters high.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.