From a4bc4b4bfa4675805e230f01ee409c04a71712e6 Mon Sep 17 00:00:00 2001 From: mloeppky Date: Fri, 29 Jul 2022 15:54:38 -0700 Subject: [PATCH] Fix raytracing of LineSegments2 when the mesh has a transformation applied. --- examples/jsm/lines/LineSegments2.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/jsm/lines/LineSegments2.js b/examples/jsm/lines/LineSegments2.js index 8582377d748223..e5d50258053510 100644 --- a/examples/jsm/lines/LineSegments2.js +++ b/examples/jsm/lines/LineSegments2.js @@ -51,11 +51,15 @@ function getWorldSpaceHalfWidth( camera, distance, resolution ) { function raycastWorldUnits( lineSegments, intersects ) { + const matrixWorld = lineSegments.matrixWorld; + for ( let i = 0, l = _instanceStart.count; i < l; i ++ ) { _line.start.fromBufferAttribute( _instanceStart, i ); _line.end.fromBufferAttribute( _instanceEnd, i ); + _line.applyMatrix4( matrixWorld ); + const pointOnLine = new Vector3(); const point = new Vector3();