Unfortunately, this is something missing from the Pyro2 Bananas that is pretty helpful in a lot of cases. All you gotta do is create a sorter class and then set a layer’s Sorter to it!
For Example, the class and the layer setting
Monkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
' This is your sorter, a class which has
' an update method that takes a stack of LayerObjects
' ISorter is a pyro-scenegraph Interface.
ClassDepthSort ImplementsISorter
Method Update(objects:Stack<LayerObject>)
' sort this stack of layerobjects
objects.Sort(Lambda(a:LayerObject,b:LayerObject)
Returna.Z-b.Z
End)
End
End
' ...whatever/wherever the layer is
layer.Sorter=NewDepthSort()
A while back I wondered the same thing and looked to see if there was a way to Sort elements in a Pyro layer – I found a slightly indirect answer finding out that something like this existed in the first Pyro engine and checked and saw that Pyro 2 layers also had sorting functionality!