Not via the library. You would have to write your own method than provides you the respective result. However, I would not utilize Object3D.name
for this. Instead, I would add a new property to Object3D.userData
(for example tag
) and then do this:
THREE.Object3D.prototype.getObjectsByTag = function( tag, result ) {
// check the current object
if ( this.userData.tag === tag ) result.push( this );
// check children
for ( var i = 0, l = this.children.length; i < l; i ++ ) {
var child = this.children[ i ];
child.getObjectsByTag( tag, result );
}
return result;
};
The method is used like so:
var objects = [];
scene.getObjectsByTag( 'car', objects ); // the found objects are written in the given array