I am trying to render a weapon model as part of my HUD, using a new display region with a new camera. Here’s my code:
self.m_HudDR = base.win.makeDisplayRegion() cam=base.makeCamera(base.win) self.m_HudCamera = NodePath(cam) self.m_HudCamera.node().setLens(base.camLens) self.m_HudScene = NodePath('HUD Scene') self.m_HudCamera.reparentTo(self.m_HudScene) self.m_HudDR.setCamera(self.m_HudCamera)
My weapon model gets reparented to self.m_HudScene. This is where I TRY to change the region sorting, but I get the most confusing results.
base.win.getDisplayRegion(1).setSort(0) self.m_HudDR.setSort(5) base.win.getDisplayRegion(2).setSort(10)
Region 1 seems to be the main camera.
Region 2 seems to be the 2d render area.
Region 2’s sort won’t go higher than 10. Only if I set the hud region to 10 does it get rendered over region 1, but then it also renders over my GUI.
I say ‘seems to be’ because I’ve found that there’s about 7 regions, including my hud region, with getNumDisplayRegions().
Anyone have any ideas or a different approach? I’ve tried camera masks and bins with no luck.