2

Drawing isometric world, where objects are not rotated is quite straightforward and is discussed here:

Drawing Isometric game worlds

Simple method, is to take ground collision rectangle of every object, and sort it by it's center (vertical coordinate on screen primary)

But in situation, with diagonal object on the screen for example - locomotive or fence in the game, and it can rotate! Objects ground collision shapes of objects A B and C

Without the object C, it is quite simple, first we draw object B (as it is higher) and A after that.

With C in mind, we need to draw object A first, then object B and lastly C (exactly opposite order in this case here).

But how to define the correct sorting operator (or other way of sorting), that would order images/objects to be drawn correctly?

Community
  • 1
  • 1
kovarex
  • 1,766
  • 18
  • 34
  • What does it matter if a different (rotated image) is used on one tile? Simply drawing them back to front should suffice, no? – Ani Jun 20 '12 at 13:49
  • if you look at this http://www.factorycraft.net/download/example-objects.png You can see, that back to front doesn't work, if all objects are tall, top of object B is under C (incorrect), as well as left part of C under A (incorrect). – kovarex Jun 20 '12 at 14:32
  • Why would B be under C if the object were sorted (perhaps by centroid) and drawn back-to-front? The order of drawing would be A, C and then B. – Ani Jun 20 '12 at 14:38
  • Yes, but A->C->B is exactly the opposite of back to front sorting, that is the problem :) B is further away (it's center is further away), so it would be drawn first, and then C, and part of B is overwriten by C. – kovarex Jun 20 '12 at 14:42
  • It depends on where your "viewer's eye" is positioned. I put the eye at a very Age of Empires-eque bottom right. – Ani Jun 20 '12 at 14:55
  • The eye position is just parameter, in this case, I say that eye position is bottom side, there are no tiles on the picture, as we are talking about objects not associated with tiles in any way. For any eye position, I can make combination of 3 objects, that can't be ordered by back to front (where back is most distant object) very simply – kovarex Jun 20 '12 at 15:00
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/12811/discussion-between-ananthonline-and-marwin) – Ani Jun 20 '12 at 15:00

0 Answers0