Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I'm trying to understand the pattern for nesting scene nodes such that you want a parent scene node to Visible all child nodes. This appears to be the purpose of SceneNode, but it's not concrete so one wanted to create a new Node that extends SceneNode would it just need to override the scene node functions and iterate over it's children for any scene node call? I'm working on coding this up now, but thought I'd ask unless I have a conceptual misunderstanding |
||||
|
Seemed to have found what I was doing wrong but don't claim to understand it. I needed to add the Parent SceneNode to the Scene before adding children scene nodes to the parent. Otherwise I would get: Uncaught TypeError: Cannot read property 'getCurrentRenderMode' of null Anyone able to help explain to me why? |
||||
|
Hi debuggeek, Did you figure this one out already? I think I can answer, but someone else chime in if I'm off the mark. Like you found, "parent" nodes and "children" nodes need to be added to the scene.RootNode in descending order because the .addChild method sets the this.scene property of the child node to be that of the parent. The error you describe shows as "TypeError: this.scene is null" in FireFox and it's coming from trying to render a child node that was added to a parent that didn't have a "this.scene" property. The parent's was null when you added the child, so (unless you set it another way) it's null for the child now too. Other than that, a parent SceneNode works as expected to set the visibility (or position, or scale, etc) of child nodes. And child nodes can be then be parent nodes for more child nodes... |
|