Hello everyone! I am new to panda3d and love it alot already!
(Edit, I found a way without upcast - but still have trouble(look further down))
Though I am stuck a lighting some models now. I’m trying to light a model I’ve got, with this code
But it keep giving me a AttributeError: ‘panda3d.core.Spotlight’ object has no attribute ‘upcastToLensNode’ error
slight = Spotlight(‘slight’)
slight.setColor(VBase4(1, 1, 1, 1))
lens = PerspectiveLens()
slight.setLens(lens)
slnp = render.attachNewNode(slight.upcastToLensNode())
slnp.setPos(10, 20, 100)
slnp.lookAt(box)
render.setLight(slnp)
/Working way:
slight = Spotlight(‘slight’)
slight.setColor((1, 10, 1, 1))
lens = PerspectiveLens()
lens.setFar(80)
slight.setLens(lens)
slnp = myHangingLights.attachNewNode(slight)
render.setLight(slnp)
(Edit, I found a way without upcast)
But I still have a problem. The lighting is now there, and I can track objects/models, with it using lookAt but for some reason the light goes straight through my models?
It reaches the ground floor model, but goes through my cubes, and walls/cubes?
Both the floor and the cubes(which don’t light) was made with blender, and have not changed any settings, so have no clue…
What can I doo?
Thank you!
Kristian