Browse Source

Line: raycast clean up.

Mr.doob 9 năm trước cách đây
mục cha
commit
d2ce916efd
1 tập tin đã thay đổi với 1 bổ sung3 xóa
  1. 1 3
      src/objects/Line.js

+ 1 - 3
src/objects/Line.js

@@ -61,11 +61,11 @@ THREE.Line.prototype.raycast = ( function () {
 
 			var index = geometry.index;
 			var attributes = geometry.attributes;
+			var positions = attributes.position.array;
 
 			if ( index !== null ) {
 
 				var indices = index.array;
-				var positions = attributes.position.array;
 
 				for ( var i = 0, l = indices.length - 1; i < l; i += step ) {
 
@@ -102,8 +102,6 @@ THREE.Line.prototype.raycast = ( function () {
 
 			} else {
 
-				var positions = attributes.position.array;
-
 				for ( var i = 0, l = positions.length / 3 - 1; i < l; i += step ) {
 
 					vStart.fromArray( positions, 3 * i );