≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
How get parent node?
Posted by:
(you are not logged in)
Enter the missing letter in: "Internat?onal"
(you are not logged in)
Text:
[quote][b]csp-games[/b] wrote: This checks the entire scene recursively, with a depth max of ten. When too slow, try run it once to write each child with its parent to a simple array (or two arrays, with corresponding indicies), Wouldn't worry about a few hundred bytes in resources. [code] var s = ccbGetSceneNodeFromName("cubeMesh2"); var p=ccbGetRootSceneNode(); var count_recursive=0; // must be global var parr=ccbGetSceneNodeParent(p,s); alert(ccbGetSceneNodeProperty(parr, "Name") ); // this works only in WebGL function ccbGetSceneNodeParent(p,s) { var rett=0; var c=ccbGetSceneNodeChildCount(p); for (i=0; i<c; i++) { var kid=ccbGetChildSceneNode(p,i); if(kid==s) {return p;} if (ccbGetSceneNodeChildCount(kid)>0) { if (count_recursive < 10) { count_recursive++; rett=ccbGetSceneNodeParent(kid,s); count_recursive--; } } } return rett; } [/code][/quote]
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
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact