some time ago i wrote control for “attach/detach physics or lights” based on distance to camera and other factors.
But i had to do tricky way to “detach physics or lights” when node is not child of some rendered parent. (rootNode in this case, controls just stop call update, no other calls when lights are not rendered). To achieve this i needed to have appState controlling from time to time if this controls spatials have rootNode ancestor, if not then remove control from list and node.(and remove related element like rigidBody from physSpace or light from some other node)
Question is, if there is some better solution for this, because this one is … ugly…
i also thought move to into “new appState each time” that will know its spatial related, and if suddenly it dont have rootNode ancestor. But here my clone will not dupplicate this appState.
so generally i ask for some advise how you do it. (if you do)