Skip to content

Commit

Permalink
Raycaster: add Raycaster.stopTraversal() (#27709)
Browse files Browse the repository at this point in the history
* Raycaster: add stop traversal on demand

* Raycaster: fix CI warn Implicit operand conversion

* Raycaster: stopTraversal on current branch only

* raycast stop traversal of children when return true

* Update Raycaster.js

Fix code style.

* Update Raycaster.js

Fix check.

---------

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
  • Loading branch information
AlaricBaraou and Mugen87 committed Apr 27, 2024
1 parent a6130f8 commit 258c28f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/Raycaster.js
Expand Up @@ -101,13 +101,15 @@ function ascSort( a, b ) {

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

let stopTraversal = false;

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

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

}

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

const children = object.children;

Expand Down

0 comments on commit 258c28f

Please sign in to comment.