I am trying to make Terraria like game using WGPU and rust. There are gaps between tiles. The gaps are bigger and more common as I get far from world center. I've read that nearest filtering should help, hovewer I am already using it.
This is my code for calculating tile positions:
glam::vec3(
self.world_center.x + chunk_size *
(chunk.coords.0 as f32) -
chunk_size / 2.0 + self.block_size
/ 2.0 + self.block_size * (x as
f32),
self.world_center.y + chunk_size *
(chunk.coords.1 as f32) -
chunk_size / 2.0 + self.block_size
/ 2.0 + self.block_size * (y as
f32),
0.0,
)
x and y is a position of a tile in a chunk. Tile (0, 0) is on the bottom left.
Thanks for your response!
f32
), I would suggest that you round all resulting numbers up (ceil
function) and see if that makes a difference. Another usual (and better) trick is to add "a half-pixel" size and then use the default rounding function. $\endgroup$