public void ChangeBlock(Vector3Int chunk, SmoothChunk.BlockChange change) { Vector3Int localVoxel = change.position; if (BuilderExists(chunk.x, chunk.y, chunk.z)) { if (localVoxel.x >= 0 && localVoxel.x < SmoothVoxelSettings.ChunkSizeX && localVoxel.y >= 0 && localVoxel.y < SmoothVoxelSettings.ChunkSizeY && localVoxel.z >= 0 && localVoxel.z < SmoothVoxelSettings.ChunkSizeZ) { Chunks[chunk].EditNextFrame(change); } else { SafeDebug.LogError(string.Format("Out of Bounds: chunk: {0}, localVoxel: {1}, Function: GenerateExplosion", chunk, localVoxel)); } } }
public void ChangeBlock(SmoothChunk.BlockChange change) { Vector3Int chunk = VoxelConversions.VoxelToChunk(change.position); Vector3Int localVoxel = VoxelConversions.GlobalToLocalChunkCoord(chunk, change.position); //Debug.LogFormat("voxel: {0}, localVoxel: {1}, chunk: {2}", voxel, localVoxel, chunk); if (BuilderExists(chunk.x, chunk.y, chunk.z)) { if (localVoxel.x >= 0 && localVoxel.x < SmoothVoxelSettings.ChunkSizeX && localVoxel.y >= 0 && localVoxel.y < SmoothVoxelSettings.ChunkSizeY && localVoxel.z >= 0 && localVoxel.z < SmoothVoxelSettings.ChunkSizeZ) { Chunks[chunk].EditNextFrame(new SmoothChunk.BlockChange(localVoxel, change.type)); } else { SafeDebug.LogError(string.Format("Out of Bounds: chunk: {0}, globalVoxel:{1}, localVoxel: {2}, Function: GenerateExplosion", chunk, change.position, localVoxel)); } } }