简体   繁体   中英

Get all node name from .dae in three.js

I'm importing a collada file in my scene. I want to know how I could list all the nodes name ?

I did this, which gives me only one name:

var dae;
loader.options.convertUpAxis = true;
loader.load( './models/collada/test.dae', function ( collada ) {
    var dae = collada.scene;
    dae.traverse( function ( child ){
        objects.push(child);
    } );

    daenode = dae.children[0].name;
    console.log(daenode);

The way your code I assume objects is an array. So why not use

for( var i = 0; i < objects.length; i++ ) {
    console.log(objects[i].name);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM