From 5d5361155113687f323574cd7752e80741872231 Mon Sep 17 00:00:00 2001 From: hlfkyo Date: Thu, 17 Oct 2024 15:36:16 +0800 Subject: [PATCH 1/2] Update Line.js Modify a bug in ray intersection for line objects --- src/objects/Line.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/objects/Line.js b/src/objects/Line.js index 858c121515749c..612079f96d2d46 100644 --- a/src/objects/Line.js +++ b/src/objects/Line.js @@ -100,7 +100,8 @@ class Line extends Object3D { _inverseMatrix.copy( matrixWorld ).invert(); _ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix ); - const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 ); + const scaleMax = matrixWorld.getMaxScaleOnAxis(); + const localThreshold = threshold / scaleMax; const localThresholdSq = localThreshold * localThreshold; const step = this.isLineSegments ? 2 : 1; From b8b63ce76f34fb1e07dd9073f5bd924752ef1034 Mon Sep 17 00:00:00 2001 From: hlfkyo Date: Thu, 17 Oct 2024 17:32:55 +0800 Subject: [PATCH 2/2] Update Line.js Modify spaces --- src/objects/Line.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objects/Line.js b/src/objects/Line.js index 612079f96d2d46..fa06bb92f35f97 100644 --- a/src/objects/Line.js +++ b/src/objects/Line.js @@ -100,7 +100,7 @@ class Line extends Object3D { _inverseMatrix.copy( matrixWorld ).invert(); _ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix ); - const scaleMax = matrixWorld.getMaxScaleOnAxis(); + const scaleMax = matrixWorld.getMaxScaleOnAxis(); const localThreshold = threshold / scaleMax; const localThresholdSq = localThreshold * localThreshold;