Advertisement Jump to content
Sign in to follow this  
Angelic Ice

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.

If you intended to correct an error in the post then please contact us.

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
Advertisement

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!