ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator Nesting scene nodes
person icon
debuggeek
Registered User
Quote
2019-02-27 21:53:11

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

person icon
debuggeek
Registered User
Quote
2019-03-01 18:40:35

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?

person icon
shoottheluck
Registered User
Quote
2019-03-11 20:16:02

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...


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |