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 (_gone) return const [];
  final pointer = shapes.borrow(shape);
  if (pointer == null) return const [];
  _pose(position, rotation);
  _f
    ..[7] = direction.x
    ..[8] = direction.y
    ..[9] = direction.z;
  final flags = _flags(filter, allHits);
  return _query(
    (hits, capacity) => jj_shape_cast(
      handle,
      pointer,
      _f,
      _f + 7,
      filter.layerMask,
      filter.ignoreBody,
      flags,
      hits,
      allHits ? capacity : 1,
    ),
    allHits,
  );
}