raycastNodeAll function Picking and input

List<SceneRaycastHit> raycastNodeAll(
  1. Node root,
  2. Ray ray, {
  3. double maxDistance = double.infinity,
  4. int layerMask = 0xFFFFFFFF,
  5. bool where(
    1. Node node
    )?,
  6. bool includeInvisible = false,
})

Casts ray through root's subtree and returns every hit, sorted nearest-first. Parameters as in raycastNode.

Implementation

List<SceneRaycastHit> raycastNodeAll(
  Node root,
  Ray ray, {
  double maxDistance = double.infinity,
  int layerMask = 0xFFFFFFFF,
  bool Function(Node node)? where,
  bool includeInvisible = false,
}) {
  final hits = <SceneRaycastHit>[];
  _walk(root, ray, maxDistance, layerMask, where, includeInvisible, true, (
    hit,
  ) {
    hits.add(hit);
  });
  hits.sort((a, b) => a.distance.compareTo(b.distance));
  return hits;
}