trace scene description/object heirarchy

0 views
Skip to first unread message

Matt N. M.

unread,
Jul 8, 2009, 9:54:15 PM7/8/09
to away3d.dev
Is there a built in method to print contents of my scene in the output
window? I need to do some diagnosis.
If not, I am sure there is a nice way with some loops, but, well, I
need someone to show me how. :-\

Thank you,
Matt

Li

unread,
Jul 8, 2009, 10:39:12 PM7/8/09
to away3...@googlegroups.com
You can use something like this:

private function findChildrenInModel(name:String, object:ObjectContainer3D, output:Array):void
        {
            var res:Object3D;
            for each(var child:Object3D in object.children)
            {
                if(child.name && child.name.indexOf(name) != -1)
                {
                    res = child;
                    output.push(res);
                }
               
                if(child is ObjectContainer3D)
                    findChildrenInModel(name, child as ObjectContainer3D, output);
            }
        }

This method recursively analyzes the children of a container to find objects that contain a given string in its name. Any possible candidates are pushed into the output array passed as a parameter.

You could easily tweak this function to trace out a hierarchy under the passed object container and hence observe your node hierarchy.

Li

Matt N. M.

unread,
Jul 9, 2009, 12:04:45 PM7/9/09
to away3d.dev
Cool, this is what I needed.

Thank you
Matt
Reply all
Reply to author
Forward
0 new messages