Tag Info

New answers tagged

1

You can use this simple calculation: int chunkX = playerX / chunkSize + coordinateOriginX; Where: playerX is the X-coordinate of the player. chunkSize is the size of the chunk. coordinateOriginX is the in-world horizontal origin of the coordinate system. The same can also be used for the Y-index, but you just have to replace the playerX value with the ...


4

If a chunk is C world units along an axis, you can convert a world unit W along that axis to a chunk index along that axis by floor(W/C) (or simply rely on integer division to drop the fractional part of the result). Now, you have to be careful since you can't actually have "negative" indices into the chunk array, which is what you'd get if you have a ...



Top 50 recent answers are included