You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote some code for a free camera movement without a player. The voxel-engine code states that if there is no player voxel.js will take the position of the camera to find chunks that are far away and remove them.
So far everything is working fine BUT the chunks won't load when the camera gets close to them again. I tried to force voxel.js to show them but that won't work too.
cp = game.camera.position.toArray();
var chunkX = Math.floor(cp[0]/32);
var chunkY = Math.floor(cp[1]/32);
var chunkZ = Math.floor(cp[2]/32);
I used game.setBlock([msg["x"],1 ,msg["y"]], c) to create the blocks. Is this the right way or will it just display the blocks until the chunk is hidden the first time?
The text was updated successfully, but these errors were encountered:
By default voxel-engine has no persistence layer; setBlock() only modifies the voxel in a loaded chunk but once chunks are unloaded they are not saved anywhere. You can handle this by persisting the chunks to network/disk/memory as they unload, or just regenerate them again. Try using the missingChunk event on game.voxels, and the game.showChunk() method; this example might be helpful: https://github.com/deathcap/voxel-land
I wrote some code for a free camera movement without a player. The voxel-engine code states that if there is no player voxel.js will take the position of the camera to find chunks that are far away and remove them.
So far everything is working fine BUT the chunks won't load when the camera gets close to them again. I tried to force voxel.js to show them but that won't work too.
cp = game.camera.position.toArray();
var chunkX = Math.floor(cp[0]/32);
var chunkY = Math.floor(cp[1]/32);
var chunkZ = Math.floor(cp[2]/32);
I used game.setBlock([msg["x"],1 ,msg["y"]], c) to create the blocks. Is this the right way or will it just display the blocks until the chunk is hidden the first time?
The text was updated successfully, but these errors were encountered: