Skip to content

Commit

Permalink
Raycaster: Return false to avoid propagation. (#28520)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob authored May 29, 2024
1 parent 1911011 commit 70d0eb1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/Raycaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,17 @@ function ascSort( a, b ) {

function intersect( object, raycaster, intersects, recursive ) {

let stopTraversal = false;
let propagate = true;

if ( object.layers.test( raycaster.layers ) ) {

stopTraversal = object.raycast( raycaster, intersects );
const result = object.raycast( raycaster, intersects );

if ( result === false ) propagate = false;

}

if ( recursive === true && stopTraversal !== true ) {
if ( propagate === true && recursive === true ) {

const children = object.children;

Expand Down

0 comments on commit 70d0eb1

Please sign in to comment.