繁体   English   中英

从r68开始,在THREE.js上正确获取getDescendants()的方法

[英]Proper way to getDescendants() on THREE.js as of r68

r68开始getDescendants()方法已从THREE.Object3D删除。

现在建议执行相同功能的方法是什么? (因为未提供警告消息...)

这是从r.68中删除的getDescendants()方法:

THREE.Object3D.prototype.getDescendants = function ( array ) {

    if ( array === undefined ) array = [];

    Array.prototype.push.apply( array, this.children );

    for ( var i = 0, l = this.children.length; i < l; i ++ ) {

        this.children[ i ].getDescendants( array );

    }

    return array;

};

如果要编写自定义内容,可以使用Object3D.traverse()方法。

object.traverse( function( node ) {

    // your code here

} );

three.js r.68

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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