upcastToLe** new prob, lighting goes through model?

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

I’m not really sure but maybe you should attach the lighting node to the same node your models are parented? (eg. render) Give it a try.

For what it’s worth, .upcastToLensNode() does nothing, and you can remove it.

The lights go through your models because shadowing needs to be explicitly enabled for objects to occlude the light source. See the shadow mapping sample program.