Geometricity and I have been bouncing back and forth,
I have
Addlight
import bge
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['Property3']
sens2 = cont.sensors['Property4']
if sens.positive and sens2.positive:
scene=bge.logic.getCurrentScene()
Light=scene.addObject('Point',own,0)
own['Light']=Light
own['Count']=+1
main()
and
EndLight
import bge
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['Property5']
sens2= cont.sensors['Property']
if sens.positive and sens2.positive:
if own['Light']!="Empty":
L=own['Light']
L.endObject()
own['Light']="Empty"
main()
And I thought this would create unique instances of a light, and remove them, however you can’t seem to add 2 lights at one time, and there is no error thrown…
The shaders generated for each object have to take each lamp into account, right? So what happens if suddenly, there are more lamps? Well that’s fine, let’s just add one (or actually, activate on that’s deactivated). But what if there’s two of the same light? Shouldn’t it be in the same location, or, what? The shader get’s confused, and only the most recently added light is visible in the shaders.
At least, that’s my understanding, and it’s why I’m still investing time (what time I have) in my lighting manager
@ sdfgeoff: I was thinking about this yesterday, that you’re unique LibLoad method should be a solution.
@ BluePrintRandom: Another option is to have multiple unique Lamps on an inactive layer (for example: [Point.000, Point.001, …]) and add those to the scene. As long as none of the Lamp objects share the same Lamp data this works up to a maximum number of Lamps, depending on how many are supported by your graphics card.
Edit: As been expected the unique LibLoad method does not work with Lamps. Sorry for any misguidance.