Isometric objects hiding other objects behind them

Started by
4 comments, last by Angelic Ice 6 years, 4 months ago

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.

 

Advertisement

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

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?

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.

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.

This topic is closed to new replies.

Advertisement