2d objects + render + lighting

ello all im trying to attach a directwaitbar to my enemies and myself as a healthbar. it works but the lighting and shadows makes the bar just look grey. i tried giving the bar a material of every kind and it still just looked grey any help? heres the code that works the healthbar

def updateHealthBar(self, task):
        
        self.playerPos = self.playerList[self.playerName].returnPos()
        self.playerHpr = self.playerList[self.playerName].returnHpr()
        
        self.bar['value'] = 100*float(self.playerList[self.playerName].getLife())/float(self.originalLife)
        self.bar.setTwoSided(True)
        self.bar.setScale(10)
        self.bar.reparentTo(render)
        
        self.bar.setPos(self.playerPos)
        self.bar.setHpr(self.playerHpr)
        
        
        return task.cont
    
    def healthBar(self, name):
        
        self.playerName = str(name)
        
        self.bar = DirectWaitBar(text = "Life", pos = (0,0,-.9), scale = .5)
        self.bar.setMaterial(self.barMaterial)
        
        self.originalLife = self.playerList[self.playerName].getLife()
        
        taskMgr.add(self.updateHealthBar, 'updates health bar')

and heres the material

self.barMaterial = Material()
        self.barMaterial.setShininess(0)

its currently shininess but any and all materials just nake it look either grey or some shade of it

You can simply disable lighting for the bar with:

self.bar.setLightOff()

David

you are like the panda god :smiley: ill try it right now and get back to you :smiley: lol

ok so, helped with the grey :smiley: but now sometimes its pure white and other times it works great. The color should be red status bar with the grey background(default directwaitbar colors) but it sometimes comes out all white, and i think it has something to do with the angle at which it gets created. any ideas?

Hmm, you want a bar that is always on the player head showing its HP?
I have those in my game and they work just fine…
I use this code, you can try it if you want:

	self.bar.reparentTo(parent)
	self.bar.setDepthWrite(False)
	self.bar.setBin('fixed', 0) 
	self.bar.setScale(scale)
	self.bar.setBillboardAxis()

“parent” variable should be your player model.

awesome will give that a shot :smiley: thanks :slight_smile:

yup works great :smiley: thanks :slight_smile: