When I use the point light class, it makes a light in the scene but only one half of the scene is lit and setMaxDistance also doesn’t seem to work.
Also when i do node.setLightOff(), it just puts light on instead of making it dark.
I am trying to make a scene with blocks and a lamp in the corner. My code (i have made the showbase class, it is screen):
a = []
b = NodePath('hi')
for x in range(20):
for y in range(20):
a.append(screen.loader.loadModel('/d/Dirt.bam'))
a[-1].setPosHprScale(x, y, 0, 0, 0, 0, 20, 20, 20)
a[-1].reparentTo(b)
b.reparentTo(screen.render)
b.setLightOff() # if i comment this, blocks appear normal, but with this line, all blocks are lit up
alight = AmbientLight('ambientLight') # this light works
alight.setColor((0.1, 0.1, 0.1, 1))
alightNP = screen.render.attachNewNode(alight)
screen.render.setLight(alightNP)
slight = PointLight('pointLight') # doesn't work, one half lit
slight.setColor((2, 2, 2, 1))
slight.setAttenuation((1, 0, 0))
slnp = screen.render.attachNewNode(slight)
slnp.setPos(0, 20, 0)
screen.render.setLight(slnp)
dlight = DirectionalLight('directionalLight')
dlight.setColor((1, 1, 1, 1))
dlNP = screen.render.attachNewNode(dlight)
dlNP.setHpr(0, 0, 0)
screen.render.setLight(dlNP)
screen.run()