PointLight from NodePath

Hi, folks!

Once again I need your help with Panda. Say I have a NodePath variable wich I retrieved by adding a point light to the scene:

PT(PointLight) pl;
NodePath the_node;

/* ... */

the_node = window->get_render().attach_new_node(pl);

At some other point I need to change some of the light’s settings, say the attenuation values, but I only have the_node and not pl.
What is the best way to solve this problem?

I’m looking forward to your answers :slight_smile:

Call .node() to get the underlying PandaNode, and then upcast it to a PointLight.

PT(PointLight) pl = DCAST(PointLight, the_node.node());
1 Like

Thank you, once again :smiley:
I really appreciate that you and drwr look into all the topics on this forum. thumb up