shapeCast method

  1. @override
List<QueryHit3D> shapeCast(
  1. Shape3D shape,
  2. Vector3 position,
  3. Quaternion rotation,
  4. Vector3 direction, {
  5. QueryFilter3D filter = QueryFilter3D.all,
  6. bool allHits = false,
})
override

Sweeps shape from position and rotation along direction. The closest hit, or every hit nearest first when allHits.

Implementation

@override
List<QueryHit3D> shapeCast(
  Shape3D shape,
  Vector3 position,
  Quaternion rotation,
  Vector3 direction, {
  QueryFilter3D filter = QueryFilter3D.all,
  bool allHits = false,
}) {
  if (_disposed || !shape.isValid) return const [];
  final (lo, hi) = _boundsOf(shape);
  final (min, max) = _turned(lo, hi, rotation);
  final half = Vector3(
    (max.x - min.x) / 2,
    (max.y - min.y) / 2,
    (max.z - min.z) / 2,
  );
  final centre = Vector3(
    (max.x + min.x) / 2,
    (max.y + min.y) / 2,
    (max.z + min.z) / 2,
  )..add(position);
  return _cast(centre, direction, half, filter, allHits);
}