Browse Source

Add threshold option to Line2 raycast

Garrett Johnson 4 years ago
parent
commit
84deae15c8
1 changed files with 8 additions and 1 deletions
  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 ray = raycaster.ray;
 			var camera = raycaster.camera;
 			var camera = raycaster.camera;
 			var projectionMatrix = camera.projectionMatrix;
 			var projectionMatrix = camera.projectionMatrix;
@@ -88,7 +95,7 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 			var geometry = this.geometry;
 			var geometry = this.geometry;
 			var material = this.material;
 			var material = this.material;
 			var resolution = material.resolution;
 			var resolution = material.resolution;
-			var lineWidth = material.linewidth;
+			var lineWidth = material.linewidth + threshold;
 
 
 			var instanceStart = geometry.attributes.instanceStart;
 			var instanceStart = geometry.attributes.instanceStart;
 			var instanceEnd = geometry.attributes.instanceEnd;
 			var instanceEnd = geometry.attributes.instanceEnd;