overlap method

List<Entity> overlap(
  1. Shape3D shape,
  2. Vector3 position,
  3. Quaternion rotation, {
  4. int layerMask = 0xFFFF,
  5. Entity? ignore,
  6. bool includeSensors = false,
})

The entities whose bodies shape at position and rotation overlaps.

Implementation

List<Entity> overlap(
  Shape3D shape,
  Vector3 position,
  Quaternion rotation, {
  int layerMask = 0xFFFF,
  Entity? ignore,
  bool includeSensors = false,
}) {
  final world = _world;
  if (world == null) return const [];
  final seen = <Entity>{};
  for (final hit in world.overlap(
    shape,
    position,
    rotation,
    filter: _filter(layerMask, ignore, includeSensors),
  )) {
    final entity = system.entityOf(hit.body);
    if (entity != null) seen.add(entity);
  }
  return seen.toList();
}