浏览代码

Fix raytracing of LineSegments2 when the mesh has a transformation applied. (#24405)

Co-authored-by: mloeppky <[email protected]>
Mitchell Loeppky 2 年之前
父节点
当前提交
fbace95ba7
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      examples/jsm/lines/LineSegments2.js

+ 4 - 0
examples/jsm/lines/LineSegments2.js

@@ -51,11 +51,15 @@ function getWorldSpaceHalfWidth( camera, distance, resolution ) {
 
 
 function raycastWorldUnits( lineSegments, intersects ) {
 function raycastWorldUnits( lineSegments, intersects ) {
 
 
+	const matrixWorld = lineSegments.matrixWorld;
+
 	for ( let i = 0, l = _instanceStart.count; i < l; i ++ ) {
 	for ( let i = 0, l = _instanceStart.count; i < l; i ++ ) {
 
 
 		_line.start.fromBufferAttribute( _instanceStart, i );
 		_line.start.fromBufferAttribute( _instanceStart, i );
 		_line.end.fromBufferAttribute( _instanceEnd, i );
 		_line.end.fromBufferAttribute( _instanceEnd, i );
 
 
+		_line.applyMatrix4( matrixWorld );
+
 		const pointOnLine = new Vector3();
 		const pointOnLine = new Vector3();
 		const point = new Vector3();
 		const point = new Vector3();