浏览代码

Add threshold option to Line2 raycast

Garrett Johnson 4 年之前
父节点
当前提交
84deae15c8
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      examples/jsm/lines/LineSegments2.js

+ 8 - 1
examples/jsm/lines/LineSegments2.js

@@ -81,6 +81,13 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
 			}
 
+			var threshold = 0;
+			if ( 'Line2' in raycaster.params ) {
+			
+				threshold = raycaster.params.Lines2.threshold || 0.0
+			
+			}
+			
 			var ray = raycaster.ray;
 			var camera = raycaster.camera;
 			var projectionMatrix = camera.projectionMatrix;
@@ -88,7 +95,7 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 			var geometry = this.geometry;
 			var material = this.material;
 			var resolution = material.resolution;
-			var lineWidth = material.linewidth;
+			var lineWidth = material.linewidth + threshold;
 
 			var instanceStart = geometry.attributes.instanceStart;
 			var instanceEnd = geometry.attributes.instanceEnd;