|
@@ -279,19 +279,15 @@
|
|
|
if ( intersects.length > 0 ) {
|
|
|
|
|
|
var intersect = intersects[ 0 ];
|
|
|
+ var face = intersect.face;
|
|
|
|
|
|
- var object = intersect.object;
|
|
|
- var positions = object.geometry.attributes.position.array;
|
|
|
+ var linePosition = line.geometry.attributes.position;
|
|
|
+ var meshPosition = mesh.geometry.attributes.position;
|
|
|
|
|
|
- for ( var i = 0, j = 0; i < 4; i ++, j += 3 ) {
|
|
|
-
|
|
|
- var index = intersect.indices[ i % 3 ] * 3;
|
|
|
-
|
|
|
- line.geometry.attributes.position.array[ j ] = positions[ index ];
|
|
|
- line.geometry.attributes.position.array[ j + 1 ] = positions[ index + 1 ];
|
|
|
- line.geometry.attributes.position.array[ j + 2 ] = positions[ index + 2 ];
|
|
|
-
|
|
|
- }
|
|
|
+ linePosition.copyAt( 0, meshPosition, face.a );
|
|
|
+ linePosition.copyAt( 1, meshPosition, face.b );
|
|
|
+ linePosition.copyAt( 2, meshPosition, face.c );
|
|
|
+ linePosition.copyAt( 3, meshPosition, face.a );
|
|
|
|
|
|
mesh.updateMatrix();
|
|
|
|