- Home /
Soritng 2d objects
Having an openworld game, something similar to Don't Starve, with many overlapping trees and other objects. What is the best way of depth sorting objects? Yes I can calculate order of objects from left to right, top to bootom, but what I should do next? Change "Order of Layer" of all onscreen objects form 0 to N or there is some trick how I can do this the other way?
Also if with static objects all is simple, how should I handle a moving character? If I'll choose Order of Layer method, than I should not be able to easily calculate characters Order of Layer based on it's x,y coordinates.
unsorted objects
static objects sorted, but not a character.
$$anonymous$$ay you give us more details? The best sort method maybe: Z on orthographic camera with orthographic transparent sort mode, static batching for static objects, dynamic batching (with same material and scale) for dynamic objects, texture atlas (changing mesh uv), etc.
Can you use Unity Pro? Do you like work with gameobjects, drawmesh or gldraw?