Hot answers tagged box2d
I just stumbled upon the answer: I checked my ScreenViewport and seemingly the viewport somehow ignores the setToOrtho(false, width, height) and the method setUnitsPerPixel(unitScale) has to becalled first... I never saw an example in which a viewport was used together with box2d, tilemap and unitScale, so I didn't even know about that method. The ...
Don't pass delta to getKeyFrame, getKeyFrame takes the state time. The state time is likely something like the sum of all the deltas you've seen so far. The state time indicates how "far" into the animation you've gone, and by constantly passing delta (which if you're running at 60 fps will be 0.016s) the Animation will always yield the first frame.
I think that there is no problem with your code. It's Box2D's thing, that it creates a little bit of skin around the polygons. According to the Box2D manual, a little gap between polygons is being intentionally created to make continuous collision resolution more stable by preventing tunneling, eg. in stacking scenarios. Manual also says one can make their ...
Only top voted, non community-wiki answers of a minimum length are eligible