is there a feasible way to get a y value in a isometric scene?

31 Views Asked by At

so, I'm creating a 2d isometric clone of Minecraft.

I already have a function to give me the x and z of where the mouse clicked. However, my issue is that the tiles can be stacked. so, in a sense my game is 3d and does have a y value for the map array.

Here is what I mean (excuse my poor artistic skills) enter image description here

this is what I mean.

How do I tell what the tiles height is?

SelectCube getMouseBlock(vector3f tile) {
    SelectCube block;

    block.position = tile;
    
    /* add 7 does to account for the height difference */
    block.position.x += 7;
    block.position.z += 7;

    return block;
}

I tried multiple versions of recasting, to get my desired block however all of them failed at some point and had bugs.

I want to be able get the y of my cursors using the 'getMouseBlock' function.

0

There are 0 best solutions below