libgdx tiledmap flicker with Nearest filtering

前端 未结 2 1689
耶瑟儿~
耶瑟儿~ 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: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.

提交回复
热议问题