Sign in to follow this  

Isometric objects hiding other objects behind them

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this