Z position strange behavier

I create a go by factory. If i create a lot of go then i have problems with draw order.
When i delete a go, draw order of other objects is randomly changed. Why it happened? Is it bug?

If z layer depends on number of creation all worked correct

--vars
M.z_start = 0.000001
M.z_max = 0.001
M.z_add = 0.000001
M.z_current = M.z_start
--in function
...
 M.z_current = M.z_current + M.z_add
    if M.z_current > M.z_max then
        M.z_current = M.z_start
    end
    e.pos3d.z = (desc.z or 0) + M.z_current

If they all have the same Z then it’s not a bug, it’s a kind of Z fighting. You should always set very slight difference in Z to avoid this like you’ve found to do.

4 Likes