# OverlapGeometry

> Returns all shapes that overlap the provided Circle geometry. A circle with a radius of zero is equivalent to PhysicsWorld.OverlapPoint. See CircleGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.6/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

## OverlapGeometry(CircleGeometry, QueryFilter, Allocator)

Returns all shapes that overlap the provided Circle geometry. A circle with a radius of zero is equivalent to [PhysicsWorld.OverlapPoint](/engine/6000.6/script-reference/unity/u2d/physics/physicsworld/overlappoint.md). See [CircleGeometry](/engine/6000.6/script-reference/unity/u2d/physics/circlegeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md)

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(CircleGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[CircleGeometry]\(/engine/6000.6/script-reference/unity/u2d/physics/circlegeometry)): The Circle geometry used to check overlap. This must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## OverlapGeometry(ReadOnlySpan\<CircleGeometry>, QueryFilter, Allocator)

Returns all shapes that overlap the provided Circle geometry. A circle with a radius of zero is equivalent to [PhysicsWorld.OverlapPoint](/engine/6000.6/script-reference/unity/u2d/physics/physicsworld/overlappoint.md). See [CircleGeometry](/engine/6000.6/script-reference/unity/u2d/physics/circlegeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md)

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<CircleGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[ReadOnlySpan\<CircleGeometry>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The Circle geometry used to check overlap. These must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## OverlapGeometry(CapsuleGeometry, QueryFilter, Allocator)

Returns all shapes that overlap the provided Capsule geometry. See [CapsuleGeometry](/engine/6000.6/script-reference/unity/u2d/physics/capsulegeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md).

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(CapsuleGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[CapsuleGeometry]\(/engine/6000.6/script-reference/unity/u2d/physics/capsulegeometry)): The Capsule geometry used to check overlap. This must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## OverlapGeometry(ReadOnlySpan\<CapsuleGeometry>, QueryFilter, Allocator)

Returns all shapes that overlap the provided Capsule geometry. See [CapsuleGeometry](/engine/6000.6/script-reference/unity/u2d/physics/capsulegeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md).

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<CapsuleGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[ReadOnlySpan\<CapsuleGeometry>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The Capsule geometry used to check overlap. These must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## OverlapGeometry(PolygonGeometry, QueryFilter, Allocator)

Returns all shapes that overlap the provided Polygon geometry. See [PolygonGeometry](/engine/6000.6/script-reference/unity/u2d/physics/polygongeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md).

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(PolygonGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[PolygonGeometry]\(/engine/6000.6/script-reference/unity/u2d/physics/polygongeometry)): The Polygon geometry used to check overlap. This must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## OverlapGeometry(ReadOnlySpan\<PolygonGeometry>, QueryFilter, Allocator)

Returns all shapes that overlap the provided Polygon geometry. See [PolygonGeometry](/engine/6000.6/script-reference/unity/u2d/physics/polygongeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md).

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<PolygonGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[ReadOnlySpan\<PolygonGeometry>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The Polygon geometry used to check overlap. These must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## OverlapGeometry(SegmentGeometry, QueryFilter, Allocator)

Returns all shapes that overlap the provided Segment geometry. See [SegmentGeometry](/engine/6000.6/script-reference/unity/u2d/physics/segmentgeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md).

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(SegmentGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[SegmentGeometry]\(/engine/6000.6/script-reference/unity/u2d/physics/segmentgeometry)): The Segment geometry used to check overlap. This must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## OverlapGeometry(ReadOnlySpan\<SegmentGeometry>, QueryFilter, Allocator)

Returns all shapes that overlap the provided Segment geometry. See [SegmentGeometry](/engine/6000.6/script-reference/unity/u2d/physics/segmentgeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md).

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<SegmentGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[ReadOnlySpan\<SegmentGeometry>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The Segment geometry used to check overlap. These must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## OverlapGeometry(ChainSegmentGeometry, QueryFilter, Allocator)

Returns all shapes that overlap the provided Chain-Segment geometry. See [ChainSegmentGeometry](/engine/6000.6/script-reference/unity/u2d/physics/chainsegmentgeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md).

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ChainSegmentGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[ChainSegmentGeometry]\(/engine/6000.6/script-reference/unity/u2d/physics/chainsegmentgeometry)): The Chain-Segment geometry used to check overlap. This must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## OverlapGeometry(ReadOnlySpan\<ChainSegmentGeometry>, QueryFilter, Allocator)

Returns all shapes that overlap the provided Chain-Segment geometry. See [ChainSegmentGeometry](/engine/6000.6/script-reference/unity/u2d/physics/chainsegmentgeometry.md), [PhysicsQuery.QueryFilter](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter.md), [PhysicsQuery.WorldOverlapResult](/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/worldoverlapresult.md) and [Allocator](/engine/6000.6/script-reference/unity/collections/allocator.md).

```csharp
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<ChainSegmentGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[ReadOnlySpan\<ChainSegmentGeometry>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The Chain-Segment geometry used to check overlap. These must be in world-space.**** (\[QueryFilter]\(/engine/6000.6/script-reference/unity/u2d/physics/physicsquery/queryfilter)): The filter to control what results are returned.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                                  | Description                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<WorldOverlapResult>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | The query overlap results. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |
