libgdx tiledmap flicker with Nearest filtering

前端 未结 2 1680
耶瑟儿~
耶瑟儿~ 2020-12-20 02:09

I am having strange artifacts on a tiledmap while scrolling with the camera clamped on the player (who is a box2d-Body).

Before getting this issue i used the linear

相关标签:
2条回答
  • 2020-12-20 03:03

    About tilesets, I posted a solution here: Getting gaps between tiled textures with libgdx

    I've been using that method with Tiled itself. You will have to adjust "margin" and "spacing" when importing tilesets in Tiled to get the effect working.

    It's 100% working for me :)

    0 讨论(0)
  • 2020-12-20 03:13

    I had a similar problem with this, and found it was due to having too small a decimal value for the camera position.

    I think what may be happening is some sort of rounding with certain tile columns/rows in the tilemap renderer.

    I fixed this by rounding to a set accuracy, like so:

    camera.position.x = Math.round(player.entity.getX() * scalePosition) / scalePosition;
    

    Experiment with various values, but I got it working by using the tile size as the scalePosition value.

    0 讨论(0)
提交回复
热议问题