Can I rely on children being shown on top of parents?

Hi!

I’m using plain JME components do make a GUI. Say I have a Node (parent) with two children: a Geometry and another Node. That child Node also has a geom as its child. So.

[java]
Node 1
/
Geom 1 Node 2
|
Geom 2
[/java]

It looks like Geom 2 shows up on top of Geom 1, but can I rely on that? I want to come up with a system to place things in the correct Z-position. It would be pretty easy if I could rely on things lower in the tree showing up on top of things on higher levels.

In the gui bucket, Z controls what order things are drawn. It has nothing to do with the graph hierarchy.

You can create a own geometryComperator if you need a really special case, howeer usually this is not necessary and counter productive.

@pspeed said: In the gui bucket, Z controls what order things are drawn. It has nothing to do with the graph hierarchy.

But for elements with the same Z? Is it just coincidence that the children are showing up on top of the parents?

@tuffe said: But for elements with the same Z? Is it just coincidence that the children are showing up on top of the parents?

Only children are drawn because only Geometry is drawn. Geometry cannot be parents.

Your ordering at the same Z is just coincidence.