# Isometric objects hiding other objects behind them

This topic is 411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey!

I have an isometric scene as displayed world for the user and the rest is axis-aligned, pretty much to have an easy collision-checking. The axis-aligned consists of cubes, hence 3d, with height. The issue are mouse clicks.

When cubes stack, as in one cube on top of another cube (and so on), projecting to isometric-representation brings one issue: The stacked cube "tower" hides cube behind them.

So if a player wants to click on top of the cube-tower, the coordinates would be projected to the wrong cube, visually hidden cubes, which the player probably has no interest of clicking. Is there a way to fix this issue?

Goals: A player needs to be able to click 1) every cube and 2) every object (enemies etc.) on top of a cube.

##### Share on other sites

Wouldn't this be solved using a screen ray or checking if a object is under the mouse pointer?

##### Share on other sites

But how would I check if an object is under the mouse pointer? The isometric world, or player's shown world offers diamond shapes, that's why I went for an axis-aligned game world, to provide simple collision etc.

If I project the mouse coordinate to the axis-aligned world, it would already be transformed to the wrong field.

Is a screen ray the same as a ray cast?

Edited by Angelic Ice

##### Share on other sites
1 hour ago, Angelic Ice said:

If I project the mouse coordinate to the axis-aligned world

Yes, don't project it.

If it projects automatically you can cancel your isometric projection by adding the inverse isometric projection to the first projection. The math for inverse is very simple it is (X*-1)

Just check to see if the bounding box is under the pointer and if it is select that object.

1 hour ago, Angelic Ice said:

Is a screen ray the same as a ray cast?

Yes but not projected.

One other option is to have select states. So if you have 3 objects on top of each other you can start by selecting the lowest one, then the middle one and last one. So to select the last you must select the same grid block 3 times.

Edited by Scouting Ninja

##### Share on other sites

Ah, I see.

That means, I need to keep and transform the bounding box from axis-aligned to the displayed view as well?

Will have to look into what mouse-collision is common for that shape, probably some diamond/point math.

Edited by Angelic Ice

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 31
• 16
• 11
• 10
• 11
• ### Forum Statistics

• Total Topics
634113
• Total Posts
3015592
×