Hey there, I'm developing a game and need help figuring out if there's a function to help me identify the inner cubes in a stack of cubes. I've attached illustrations of what I mean. Each cube is given a corresponding number starting at the bottom at x1z1y1 (just called 1). Each cube is counted up as shown in the diagram. I'm trying to identify what the center cube numbers are given the construction of the cube, and whether there's a function which will work for any proportion of cube stack. So in the examples below, for a 4x3x4 stack the center cube numbers are 18,19,30 and 31. For the other example a 4x4x5 stack the center cubes are 22,23,26,27,38,39,42,43,54,55,58,59.
Any clarification please don't hesitate to ask.
Any clarification please don't hesitate to ask.