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
Three.js LineSegment2.js。如何使用光线投射识别单击或悬停的线段_Three.js_Raycasting - Fatal编程技术网

Three.js LineSegment2.js。如何使用光线投射识别单击或悬停的线段

Three.js LineSegment2.js。如何使用光线投射识别单击或悬停的线段,three.js,raycasting,Three.js,Raycasting,我正在尝试使用raycast确定在三个JS中的N点LineSegment2中单击的线段。这样做的正确方法是什么。 nodePositionCollection-包含向量3位置 for (let index = 1; index < this.nodePositionCollection.length; index++) { const source = this.nodePositionCollection[0]; const target = this.node

我正在尝试使用raycast确定在三个JS中的N点LineSegment2中单击的线段。这样做的正确方法是什么。 nodePositionCollection-包含向量3位置

 for (let index = 1; index < this.nodePositionCollection.length; index++) {
      const source = this.nodePositionCollection[0];
      const target = this.nodePositionCollection[index];
      this.traffic[index - 1] = { source, target };
      positions.push(
        source.position.x,
        source.position.y,
        source.position.z,
        target.position.x,
        target.position.y,
        target.position.z
      );
      colors.push(color.r, color.b, color.g, color.r, color.b, color.g);
      this.connectionCount++;
    }

for(让index=1;index