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
Read time 16 minutesLast updated 6 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- 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. See CircleGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(CircleGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Circle geometry used to check overlap. This must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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. See CircleGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<CircleGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Circle geometry used to check overlap. These must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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(CircleGeometry, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Circle geometry. See CircleGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(CircleGeometry geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Circle geometry used to check overlap. This must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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>, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Circle geometry. See CircleGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<CircleGeometry> geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Circle geometry used to check overlap. These must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(CapsuleGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Capsule geometry used to check overlap. This must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<CapsuleGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Capsule geometry used to check overlap. These must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Capsule geometry. See CapsuleGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(CapsuleGeometry geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Capsule geometry used to check overlap. This must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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>, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Capsule geometry. See CapsuleGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<CapsuleGeometry> geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Capsule geometry used to check overlap. These must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(PolygonGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Polygon geometry used to check overlap. This must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<PolygonGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Polygon geometry used to check overlap. These must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Polygon geometry. See PolygonGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(PolygonGeometry geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Polygon geometry used to check overlap. This must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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>, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Polygon geometry. See PolygonGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<PolygonGeometry> geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Polygon geometry used to check overlap. These must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(SegmentGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Segment geometry used to check overlap. This must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<SegmentGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Segment geometry used to check overlap. These must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Segment geometry. See SegmentGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(SegmentGeometry geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Segment geometry used to check overlap. This must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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>, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Segment geometry. See SegmentGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<SegmentGeometry> geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Segment geometry used to check overlap. These must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ChainSegmentGeometry geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Chain-Segment geometry used to check overlap. This must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<ChainSegmentGeometry> geometry, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Chain-Segment geometry used to check overlap. These must be in world-space.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Chain-Segment geometry. See ChainSegmentGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ChainSegmentGeometry geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Chain-Segment geometry used to check overlap. This must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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>, Vector2, QueryFilter, Allocator)
Returns all shapes that overlap the provided Chain-Segment geometry. See ChainSegmentGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
public NativeArray<PhysicsQuery.WorldOverlapResult> OverlapGeometry(ReadOnlySpan<ChainSegmentGeometry> geometry, Vector2 origin, PhysicsQuery.QueryFilter filter, Allocator allocator = Allocator.Temp)
Parameters
The Chain-Segment geometry used to check overlap. These must be in local-space, relative to .
originThe point, in world space, that the geometry is defined relative to. This lets the geometry be authored in a local frame instead of being translated into world space before the query.
The filter to control what results are returned.
The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.
Returns
Type | Description |
|---|---|
| NativeArray<WorldOverlapResult> | 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. |