Rendering Order

How can I specify the order I want my nodes rendered? I have 2 nodes. One is parented to aspect2d and the other to base.a2dBottomRight. The node parented to aspect2d appears on top of the other node, and I need it to be the other way around. Thanks for any insight in how I can solve this.

Two possible answers.

(1) Don’t parent them to aspect2d and base.a2dBottomRight. Instead, parent both to the same node, e.g. aspect2d, in the order that you require them. Use a relative setPos() to place the one node in the corner.

(2) Use bins. You can use an existing bin, like gui-popup, which is defined to render on top of everything else:

cornerNode.setBin('gui-popup', 0)

Or you can put both objects in the fixed bin, which allows you to specify their relative order:

centerNode.setBin('fixed', 10)
cornerNode.setBin('fixed', 20)

Only trouble with using the fixed bin is it breaks the automatic ordering from the scene graph, so now you will also have to use an explicit bit setting for all of the child objects on your two gui nodes.

You can also create additional custom bins if the existing bins are not suitable to your needs. The manual talks more about bins; see the page entitled How to Control Render Order.



Thanks for the help. Parenting both nodes to render2d and setting one based on the relative location of the other works very nicely for what I needed. Thanks again for the quick and thorough response.