castNearest method

RaycastHit? castNearest(
  1. Ray ray,
  2. Node root, {
  3. double maxDistance = 1000,
})

Returns the nearest hit, or null.

Implementation

RaycastHit? castNearest(Ray ray, Node root, {double maxDistance = 1000}) {
  final hits = cast(ray, root, maxDistance: maxDistance);
  return hits.isNotEmpty ? hits.first : null;
}