|
@@ -80,10 +80,20 @@ THREE.Ray = function ( origin, direction, near, far ) {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- this.intersectObject = function ( object ) {
|
|
|
|
|
|
+ this.intersectObject = function ( object, recursive ) {
|
|
|
|
|
|
var intersect, intersects = [];
|
|
var intersect, intersects = [];
|
|
|
|
|
|
|
|
+ if ( recursive === true ) {
|
|
|
|
+
|
|
|
|
+ for ( var i = 0, l = object.children.length; i < l; i ++ ) {
|
|
|
|
+
|
|
|
|
+ Array.prototype.push.apply( intersects, this.intersectObject( object.children[ i ], recursive ) );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
if ( object instanceof THREE.Particle ) {
|
|
if ( object instanceof THREE.Particle ) {
|
|
|
|
|
|
distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
|
|
distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
|
|
@@ -125,7 +135,7 @@ THREE.Ray = function ( origin, direction, near, far ) {
|
|
// Checking faces
|
|
// Checking faces
|
|
|
|
|
|
var f, fl, face, dot, scalar,
|
|
var f, fl, face, dot, scalar,
|
|
- rangeSq = this.range*this.range,
|
|
|
|
|
|
+ rangeSq = this.range * this.range,
|
|
geometry = object.geometry,
|
|
geometry = object.geometry,
|
|
vertices = geometry.vertices,
|
|
vertices = geometry.vertices,
|
|
objMatrix;
|
|
objMatrix;
|
|
@@ -226,13 +236,13 @@ THREE.Ray = function ( origin, direction, near, far ) {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- this.intersectObjects = function ( objects ) {
|
|
|
|
|
|
+ this.intersectObjects = function ( objects, recursive ) {
|
|
|
|
|
|
var intersects = [];
|
|
var intersects = [];
|
|
|
|
|
|
for ( var i = 0, l = objects.length; i < l; i ++ ) {
|
|
for ( var i = 0, l = objects.length; i < l; i ++ ) {
|
|
|
|
|
|
- Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ] ) );
|
|
|
|
|
|
+ Array.prototype.push.apply( intersects, this.intersectObject( objects[ i ], recursive ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|