public bool isVoxelSolid(Vector3Int pos) { Vector3Int chunkCoord = WorldData.GlobalPosToChunkCoord(pos); pos -= WorldData.ChunkCoordToGlobalPos(chunkCoord); if (_chunks.ContainsKey(chunkCoord)) { return(_chunks[chunkCoord].IsVoxelSolid(new Vector3Int(Mathf.Abs(pos.x), Mathf.Abs(pos.y), Mathf.Abs(pos.z)))); } else { return(true); // If chunk dosnt not exist currently. } }
private static void AddVoxelMod(VoxelMod voxelMod, Vector3Int offset) { Vector3Int chunkCoord = WorldData.GlobalPosToChunkCoord(voxelMod._pos + offset); Vector3Int pos = (voxelMod._pos + offset) - WorldData.ChunkCoordToGlobalPos(chunkCoord); if (_voxelMods.ContainsKey(chunkCoord)) { _voxelMods[chunkCoord].Add(new VoxelMod(pos, voxelMod._id)); // Override other voxel. } else { _voxelMods.Add(chunkCoord, new List <VoxelMod>() { new VoxelMod(pos, voxelMod._id) }); } }