# Isometric depth sorting

**URL:** <https://forum.kirupa.com/t/isometric-depth-sorting/181957>\
**Category:** flash\
**Created:** [March 14, 2006, 3:46pm UTC](https://forum.kirupa.com/t/isometric-depth-sorting/181957 "2006-03-14T15:46:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![klem\_johansen](https://avatars.discourse-cdn.com/v4/letter/k/aeb1de/32.png) [@klem\_johansen](https://forum.kirupa.com/u/klem_johansen)\
**Post date:** [March 14, 2006, 3:46pm UTC](https://forum.kirupa.com/t/isometric-depth-sorting/181957/1 "2006-03-14T15:46:53Z")

</div>

I’ve built several games using isometric display math and they’ve worked out well enough, but for a new project I’ve elected to use a method that allows objects to be pushed & raise above the floor. I’m using concepts used in this tutorial:

[http://www.kirupa.com/developer/actionscript/isometric\_transforms.htm](http://www.kirupa.com/forum/../developer/actionscript/isometric_transforms.htm)

So far, it’s working really well, but depth-sorting has me at a loss. Using traditional methods like the ones described in this tutorial don’t work for my purposes:

[http://www.kirupa.com/developer/isometric/depth\_sorting.htm](http://www.kirupa.com/forum/../developer/isometric/depth_sorting.htm)

I’m using a set of functions to convert x,y,z (3d space) to x,y (screen). I’ve come up with a way to assign a depth value to every object and then sort them (rather than swapping directly to that number which limits the depth resolution since Flash supports a finite # of layers). That works OK, but I can’t seem to get it to take an object’s dimensions (a,b,c) into account.

Any ideas? I can post some of the code here, but I fear that it might just confuse the issue.

---

<div class="post-metadata">

**Author:** ![klem\_johansen](https://avatars.discourse-cdn.com/v4/letter/k/aeb1de/32.png) [@klem\_johansen](https://forum.kirupa.com/u/klem_johansen)\
**Post date:** [March 20, 2006, 2:50am UTC](https://forum.kirupa.com/t/isometric-depth-sorting/181957/2 "2006-03-20T02:50:40Z")

</div>

I think I’ve got it mostly figured out-

depth in Iso is illustrated on the \_y position. But just noting the \_y of the instance won’t work.

instead, generate 2 numbers based on the object’s min depth & max depth

- “board” is the container clip & the axes in question are x,y,z where Y denotes up & down

Now all I need to do is use these two numbers to sort the clips- - - ugh.

all the overlap rules:

|—a---| |----b—|  
is easy, but this  
|--------|—b---|-------a---------------------|  
isn’t so obvious since A needs to be below B (a floor, for example).
