I'm attempting to create a hexagonal map by following the example at .
Is there a way to generate hexagons instead of cubes?
Using the first option from the manual resulted in creating a hexagonal mesh and positioning it.
However, the second option successfully created the hexagon itself, but the class did not work with it.
Code: https://github.com/drPapus/HEX/blob/master/src/client/client.ts
interface VoxelWorld{
cellSize:number
cellSliceSize:number
cell:any
}
class VoxelWorld {
static faces: any;
constructor(cellSize: any) {
this.cellSize = cellSize;
this.cellSliceSize = cellSize * cellSize;
this.cell = new Uint8Array(cellSize * cellSize * cellSize);
}
computeVoxelOffset(x:number, y:number, z:number) {
const {cellSize, cellSliceSize} = this;
const voxelX = MathUtils.euclideanModulo(x, cellSize) | 0;
const voxelY = MathUtils.euclideanModulo(y, cellSize) | 0;
const voxelZ = MathUtils.euclideanModulo(z, cellSize) | 0;
return voxelY * cellSliceSize + voxelZ * cellSize + voxelX;
}
// more code...