I thought about moving the world instead of the camera, the only problem is collisions won't work since they are all sphere to something.
The simplest solution I have come up with so far is to convert the players x/z position to find what array element of the world they are in.
The world is a 2D array of square meshes, e.g. World(50,50)
If each mesh is 256*256 then the player is array element World(entityx#(player)/256,entityz#(player)/256).
Then search an area of the array centred around the element that the player is in, the size of the area to search is based on the camera's viewdistance divided by the size of a mesh.
PsuedoCode
If player has moved
dist=viewdistance/meshsize
MinX=playerx-dist
MaxX=playerx+dist
MinZ=playerz-dist
MaxZ=playerz+dist
Loop
If World(x,z)=0 then LoadMesh(whatever)
Next
Endif
Deletion of the meshes is done in a similar way but this time only search the perimiter of a larger area again centred on the players x/z position.
This means you aren't searching the entire 50*50 array every frame to calculate distance/visibility.
Also the visiblility doesn't have to be calculated every frame, it only needs recalculating if the player moves into a new x/z array position.
The simplest solution I have come up with so far is to convert the players x/z position to find what array element of the world they are in.
The world is a 2D array of square meshes, e.g. World(50,50)
If each mesh is 256*256 then the player is array element World(entityx#(player)/256,entityz#(player)/256).
Then search an area of the array centred around the element that the player is in, the size of the area to search is based on the camera's viewdistance divided by the size of a mesh.
PsuedoCode
If player has moved
dist=viewdistance/meshsize
MinX=playerx-dist
MaxX=playerx+dist
MinZ=playerz-dist
MaxZ=playerz+dist
Loop
If World(x,z)=0 then LoadMesh(whatever)
Next
Endif
Deletion of the meshes is done in a similar way but this time only search the perimiter of a larger area again centred on the players x/z position.
This means you aren't searching the entire 50*50 array every frame to calculate distance/visibility.
Also the visiblility doesn't have to be calculated every frame, it only needs recalculating if the player moves into a new x/z array position.