diff --git a/docs/api/core/Ray.html b/docs/api/core/Ray.html index 97aa7902ecb32568e193fc0f0f515fc8e8925e07..cdc8511dcb23280bba8007063382fe97bac09ce2 100644 --- a/docs/api/core/Ray.html +++ b/docs/api/core/Ray.html @@ -10,15 +10,18 @@

Properties

-

.[page:Vector3 todo]

+

.[page:Vector3 origin]

+ +

.[page:Vector3 direction]

Methods

-

.todo( [page:Vector3 todo] )

-
-todo — todo
-
+

.setPrecision( [page:Float value] )

+ +

.intersectObject( [page:Object3D object] ) [page:Object]

+ +

.intersectObjects( [page:Array objects] ) [page:Array]

Source

diff --git a/src/core/Ray.js b/src/core/Ray.js index 1b911f01f068579a22475438b6523c4b31cd7b95..9e97b26bf8fd6f43eb364a411111686c72663e0d 100644 --- a/src/core/Ray.js +++ b/src/core/Ray.js @@ -7,23 +7,6 @@ THREE.Ray = function ( origin, direction ) { this.origin = origin || new THREE.Vector3(); this.direction = direction || new THREE.Vector3(); - this.intersectObjects = function ( objects ) { - - var i, l, object, - intersects = []; - - for ( i = 0, l = objects.length; i < l; i ++ ) { - - Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ] ) ); - - } - - intersects.sort( function ( a, b ) { return a.distance - b.distance; } ); - - return intersects; - - }; - var precision = 0.0001; this.setPrecision = function ( value ) { @@ -178,6 +161,22 @@ THREE.Ray = function ( origin, direction ) { } + this.intersectObjects = function ( objects ) { + + var intersects = []; + + for ( var i = 0, l = objects.length; i < l; i ++ ) { + + Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ] ) ); + + } + + intersects.sort( function ( a, b ) { return a.distance - b.distance; } ); + + return intersects; + + }; + var v0 = new THREE.Vector3(), v1 = new THREE.Vector3(), v2 = new THREE.Vector3(); var dot, intersect, distance; @@ -217,4 +216,4 @@ THREE.Ray = function ( origin, direction ) { } -}; +}; \ No newline at end of file