Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在THREE.js中从线几何体切换到网格几何体_Javascript_Three.js_Mesh - Fatal编程技术网

Javascript 在THREE.js中从线几何体切换到网格几何体

Javascript 在THREE.js中从线几何体切换到网格几何体,javascript,three.js,mesh,Javascript,Three.js,Mesh,当我尝试创建一个布尔函数,将几何体从直线更改为网格时,我在three.js中遇到了一个与bufferGeometry相关的错误 if (value == true){ scene.remove(shape); shape = new THREE.Line(genGeometry, lineMaterial); scene.add(shape); } else{

当我尝试创建一个布尔函数,将几何体从直线更改为网格时,我在three.js中遇到了一个与bufferGeometry相关的错误

        if (value == true){
            scene.remove(shape);
            shape = new THREE.Line(genGeometry, lineMaterial);
            scene.add(shape);
        }
        else{
            scene.remove(shape);
            shape = new THREE.Mesh(genGeometry, meshBasicMaterial);
            scene.add(shape);           
        }
有没有更好的方法来解决这个问题?或者也许有人能解释这个错误

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

                    addBuffer( _webglObjects, geometryGroupsList[ i ], object );

                }
for(变量i=0,l=geometryGroupsList.length;i

无法读取undefined的属性'length'

你在哪里声明了geometryGroupsList?我不知道它在三个jsMB中。如果你包括一个坏人,因为你的geometryGroupsList==undefined,请尝试在for()之前控制台.log(geometryGroupsList)它是未定义的,但我没有调用geometryGroupsList(我的初始几何体确实出现在场景中)--它被三次调用(var i=0,l=geometryGroupsList.length;i