|
@@ -1,4 +1,5 @@
|
|
|
import { Ray } from '../math/Ray.js';
|
|
|
+import { Layers } from './Layers.js';
|
|
|
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
@@ -14,6 +15,7 @@ function Raycaster( origin, direction, near, far ) {
|
|
|
this.near = near || 0;
|
|
|
this.far = far || Infinity;
|
|
|
this.camera = null;
|
|
|
+ this.layers = new Layers();
|
|
|
|
|
|
this.params = {
|
|
|
Mesh: {},
|
|
@@ -44,9 +46,11 @@ function ascSort( a, b ) {
|
|
|
|
|
|
function intersectObject( object, raycaster, intersects, recursive ) {
|
|
|
|
|
|
- if ( object.visible === false ) return;
|
|
|
+ if ( object.layers.test( raycaster.layers ) ) {
|
|
|
|
|
|
- object.raycast( raycaster, intersects );
|
|
|
+ object.raycast( raycaster, intersects );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
if ( recursive === true ) {
|
|
|
|