How do you keep "unrelated" Spatials/Lights "in sync" (position, orientation)?

I think I’ve come across a specific case of a general problem.

Say you have an object that emits light, for example, your character holds a flashlight. You would want the light to be attached to the character node, so it’s position, orientation and scale follows that of the character, but then the light would not have any effect on the environment, because lights only affect what is “under them” in the node hierarchy.

Expressed another way, if you have a Spatial/Light that should be kept in sync, position, orientation and scale wise, with some other spatial/light, but they cannot be under a common node, due to “technical reasons”, how to you “keep them in sync”? Is there some API method that does that for you?

http://hub.jmonkeyengine.org/javadoc/com/jme3/scene/LightNode.html

As far as i know you could put that light anywhere in the scenegraph hirachy, the nod esynchronizes its position and rotation then.

1 Like

The key to remember is that Spatial.addLight() has NOTHING to do with light position and EVERYTHING to do with what parts of the scene graph are affected.

So, Empire is right… to synch position you do it with the light node.

…but there’s a secondary takeaway from the above in that you can add a light all over the scene graph if you want to. It need not only be added to one spatial.

1 Like