I’ve just added a custom mouse pointer (a texture card) to my game and I have tied it to the mouse without any great problems. I am having a bit of trouble with the render order, though.
The mouse pointer card is parented to render2d when then game starts. When I create menus later on, they end up on top of the mouse pointer. That is, the mouse pointer slips behind the menus instead of remaining in front of them, and being useful.
I tried using binning to solve this issue, but it didn’t work. Here’s the code I set up the mouse pointer with. I’ve pieced it together from other forum posts and from snippets in the manual.
self.cursor = loader.loadModel("../Models/Cursor.egg")
props = WindowProperties()
What I need is simply to have the mouse cursor render last of all the things attached to render2d, so it will be on top of anything else in render2d.
While searching the forums for a solution to this problem, I found this post:
[url]Draw order and GUI elements]
Wherein the very knowledgeable drwr informs the poster that he must place his mouse cursor card in the “gui-popup” bin rather than the “fixed” bin. I tried it, and now my mouse cursor card is on top of the menus, just like I wanted. I agree with the person who mentioned, in that post, that it might be a good idea to add a mention of the “gui-popup” bin to the manual page http://www.panda3d.org/manual/index.php/How_to_Control_Render_Order to make it easier for people to learn of its existence.
Sounds like a useful addition. Would you mind making it?
The link to log in to edit the wiki is panda3d.org/wikiedit . When you log in, it acts as if there was an error and you didn’t log in. It’s mistaken. Pay that no mind, and click back on the Manual link anyway. There should be a range of edit buttons on the bottom of the page now.
Be sure not to forget the Editing Guidelines, though:
If I add it, what should i put for its ‘sort’ value?