basically my chunks are loaded at the right spot but unloaded at the wrong place this images shows you what i mean
http://s4.postimg.org/qi9te6dpp/Untitled.png
basically i want the chunk to be loaded when it’s x comes from the right side off the screen!!
but when i unload it it takes the first x from left again, so it removes chunk while chunk is still in the camera bounds
i want it to unload on chunkX + chunkWidth’s x instead
if that makes sense xD
this is where i draw chunks
public void draw(SpriteBatch batch) {
for(int x = 0; x < chunks.length; x++){
for(int y = 0; y < chunks.length; y++){
if(camera.frustum.pointInFrustum(chunks[x][y].getChunkPos().x , chunks[x][y].getChunkPos().y, 0)){
chunks[x][y].draw(batch);
}
}
}
}