Class GravitasQuery2DService
Owns batched pure 2D query behavior for one GravitasWorldContext.
public sealed class GravitasQuery2DService
- Inheritance
-
GravitasQuery2DService
- Inherited Members
Constructors
GravitasQuery2DService(GravitasWorldContext)
Initializes a pure 2D query service for the supplied context.
public GravitasQuery2DService(GravitasWorldContext context)
Parameters
contextGravitasWorldContextThe owning world context.
Properties
Context
Gets the owning world context.
public GravitasWorldContext Context { get; }
Property Value
LastBatchCandidateCount
Gets the summed candidate count reported by the last pure 2D batch query call.
public int LastBatchCandidateCount { get; }
Property Value
LastBatchHitCount
Gets the number of hits accepted by the last pure 2D batch query call.
public int LastBatchHitCount { get; }
Property Value
LastBatchRequestCount
Gets the number of requests processed by the last pure 2D batch query call.
public int LastBatchRequestCount { get; }
Property Value
Methods
OverlapAabb(Vector2d, Vector2d, out Physics2DHit)
Finds the closest active pure 2D collider overlapping the supplied axis-aligned box.
public bool OverlapAabb(Vector2d center, Vector2d size, out Physics2DHit hit)
Parameters
centerVector2dsizeVector2dhitPhysics2DHit
Returns
OverlapAabb(Vector2d, Vector2d, PhysicsLayerMask, out Physics2DHit)
Finds the closest active pure 2D collider on an included layer overlapping the supplied axis-aligned box.
public bool OverlapAabb(Vector2d center, Vector2d size, PhysicsLayerMask layerMask, out Physics2DHit hit)
Parameters
centerVector2dsizeVector2dlayerMaskPhysicsLayerMaskhitPhysics2DHit
Returns
OverlapAabbAll(Vector2d, Vector2d, PhysicsLayerMask, SwiftList<Physics2DHit>)
Writes all active pure 2D colliders on included layers that overlap the supplied axis-aligned box.
public int OverlapAabbAll(Vector2d center, Vector2d size, PhysicsLayerMask layerMask, SwiftList<Physics2DHit> results)
Parameters
centerVector2dsizeVector2dlayerMaskPhysicsLayerMaskresultsSwiftList<Physics2DHit>
Returns
- int
The number of hits written to
results.
OverlapAabbAll(Vector2d, Vector2d, SwiftList<Physics2DHit>)
Writes all active pure 2D colliders overlapping the supplied axis-aligned box into results.
public int OverlapAabbAll(Vector2d center, Vector2d size, SwiftList<Physics2DHit> results)
Parameters
centerVector2dsizeVector2dresultsSwiftList<Physics2DHit>
Returns
- int
The number of hits written to
results.
OverlapAabbAllBatch(ReadOnlySpan<PhysicsOverlapAabb2DRequest>, SwiftList<Physics2DHit>, Span<PhysicsQueryHitRange>)
Executes multiple pure 2D AABB overlaps and appends all hits into one caller-owned hit buffer.
public int OverlapAabbAllBatch(ReadOnlySpan<PhysicsOverlapAabb2DRequest> requests, SwiftList<Physics2DHit> hits, Span<PhysicsQueryHitRange> ranges)
Parameters
requestsReadOnlySpan<PhysicsOverlapAabb2DRequest>hitsSwiftList<Physics2DHit>rangesSpan<PhysicsQueryHitRange>
Returns
OverlapAabbBatch(ReadOnlySpan<PhysicsOverlapAabb2DRequest>, Span<Physics2DHit>)
Executes multiple pure 2D AABB overlaps and writes one closest-hit slot per request.
public int OverlapAabbBatch(ReadOnlySpan<PhysicsOverlapAabb2DRequest> requests, Span<Physics2DHit> closestHits)
Parameters
requestsReadOnlySpan<PhysicsOverlapAabb2DRequest>closestHitsSpan<Physics2DHit>
Returns
OverlapCircle(Vector2d, Fixed64, out Physics2DHit)
Finds the closest active pure 2D collider overlapping the supplied query circle.
public bool OverlapCircle(Vector2d center, Fixed64 radius, out Physics2DHit hit)
Parameters
centerVector2dradiusFixed64hitPhysics2DHit
Returns
OverlapCircle(Vector2d, Fixed64, PhysicsLayerMask, out Physics2DHit)
Finds the closest active pure 2D collider on an included layer overlapping the supplied query circle.
public bool OverlapCircle(Vector2d center, Fixed64 radius, PhysicsLayerMask layerMask, out Physics2DHit hit)
Parameters
centerVector2dradiusFixed64layerMaskPhysicsLayerMaskhitPhysics2DHit
Returns
OverlapCircleAll(Vector2d, Fixed64, PhysicsLayerMask, SwiftList<Physics2DHit>)
Writes all active pure 2D colliders on included layers that overlap the query circle.
public int OverlapCircleAll(Vector2d center, Fixed64 radius, PhysicsLayerMask layerMask, SwiftList<Physics2DHit> results)
Parameters
centerVector2dradiusFixed64layerMaskPhysicsLayerMaskresultsSwiftList<Physics2DHit>
Returns
- int
The number of hits written to
results.
OverlapCircleAll(Vector2d, Fixed64, SwiftList<Physics2DHit>)
Writes all active pure 2D colliders overlapping the query circle into results.
public int OverlapCircleAll(Vector2d center, Fixed64 radius, SwiftList<Physics2DHit> results)
Parameters
centerVector2dradiusFixed64resultsSwiftList<Physics2DHit>
Returns
- int
The number of hits written to
results.
OverlapCircleAllBatch(ReadOnlySpan<PhysicsOverlapCircle2DRequest>, SwiftList<Physics2DHit>, Span<PhysicsQueryHitRange>)
Executes multiple pure 2D circle overlaps and appends all hits into one caller-owned hit buffer.
public int OverlapCircleAllBatch(ReadOnlySpan<PhysicsOverlapCircle2DRequest> requests, SwiftList<Physics2DHit> hits, Span<PhysicsQueryHitRange> ranges)
Parameters
requestsReadOnlySpan<PhysicsOverlapCircle2DRequest>hitsSwiftList<Physics2DHit>rangesSpan<PhysicsQueryHitRange>
Returns
OverlapCircleBatch(ReadOnlySpan<PhysicsOverlapCircle2DRequest>, Span<Physics2DHit>)
Executes multiple pure 2D circle overlaps and writes one closest-hit slot per request.
public int OverlapCircleBatch(ReadOnlySpan<PhysicsOverlapCircle2DRequest> requests, Span<Physics2DHit> closestHits)
Parameters
requestsReadOnlySpan<PhysicsOverlapCircle2DRequest>closestHitsSpan<Physics2DHit>
Returns
OverlapPolygon(ReadOnlySpan<Vector2d>, out Physics2DHit)
Finds the closest active pure 2D collider overlapping the supplied convex polygon.
public bool OverlapPolygon(ReadOnlySpan<Vector2d> vertices, out Physics2DHit hit)
Parameters
verticesReadOnlySpan<Vector2d>hitPhysics2DHit
Returns
OverlapPolygon(ReadOnlySpan<Vector2d>, PhysicsLayerMask, out Physics2DHit)
Finds the closest active pure 2D collider on an included layer overlapping the supplied convex polygon.
public bool OverlapPolygon(ReadOnlySpan<Vector2d> vertices, PhysicsLayerMask layerMask, out Physics2DHit hit)
Parameters
verticesReadOnlySpan<Vector2d>layerMaskPhysicsLayerMaskhitPhysics2DHit
Returns
OverlapPolygonAll(ReadOnlySpan<Vector2d>, PhysicsLayerMask, SwiftList<Physics2DHit>)
Writes all active pure 2D colliders on included layers that overlap the supplied convex polygon.
public int OverlapPolygonAll(ReadOnlySpan<Vector2d> vertices, PhysicsLayerMask layerMask, SwiftList<Physics2DHit> results)
Parameters
verticesReadOnlySpan<Vector2d>layerMaskPhysicsLayerMaskresultsSwiftList<Physics2DHit>
Returns
- int
The number of hits written to
results.
OverlapPolygonAll(ReadOnlySpan<Vector2d>, SwiftList<Physics2DHit>)
Writes all active pure 2D colliders overlapping the supplied convex polygon into results.
public int OverlapPolygonAll(ReadOnlySpan<Vector2d> vertices, SwiftList<Physics2DHit> results)
Parameters
verticesReadOnlySpan<Vector2d>resultsSwiftList<Physics2DHit>
Returns
- int
The number of hits written to
results.
OverlapPolygonAllBatch(ReadOnlySpan<PhysicsOverlapPolygon2DRequest>, ReadOnlySpan<Vector2d>, SwiftList<Physics2DHit>, Span<PhysicsQueryHitRange>)
Executes multiple pure 2D convex polygon overlaps and appends all hits into one caller-owned hit buffer.
public int OverlapPolygonAllBatch(ReadOnlySpan<PhysicsOverlapPolygon2DRequest> requests, ReadOnlySpan<Vector2d> vertices, SwiftList<Physics2DHit> hits, Span<PhysicsQueryHitRange> ranges)
Parameters
requestsReadOnlySpan<PhysicsOverlapPolygon2DRequest>verticesReadOnlySpan<Vector2d>hitsSwiftList<Physics2DHit>rangesSpan<PhysicsQueryHitRange>
Returns
OverlapPolygonBatch(ReadOnlySpan<PhysicsOverlapPolygon2DRequest>, ReadOnlySpan<Vector2d>, Span<Physics2DHit>)
Executes multiple pure 2D convex polygon overlaps and writes one closest-hit slot per request.
public int OverlapPolygonBatch(ReadOnlySpan<PhysicsOverlapPolygon2DRequest> requests, ReadOnlySpan<Vector2d> vertices, Span<Physics2DHit> closestHits)
Parameters
requestsReadOnlySpan<PhysicsOverlapPolygon2DRequest>verticesReadOnlySpan<Vector2d>closestHitsSpan<Physics2DHit>
Returns
Raycast(Vector2d, Vector2d, out Physics2DHit)
Finds the closest pure 2D collider hit by the segment from start to end.
public bool Raycast(Vector2d start, Vector2d end, out Physics2DHit hit)
Parameters
startVector2dendVector2dhitPhysics2DHit
Returns
Raycast(Vector2d, Vector2d, PhysicsLayerMask, out Physics2DHit)
Finds the closest pure 2D collider on an included layer hit by the segment.
public bool Raycast(Vector2d start, Vector2d end, PhysicsLayerMask layerMask, out Physics2DHit hit)
Parameters
startVector2dendVector2dlayerMaskPhysicsLayerMaskhitPhysics2DHit
Returns
RaycastAll(Vector2d, Vector2d, PhysicsLayerMask, SwiftList<Physics2DHit>)
Writes all pure 2D colliders on included layers hit by the segment into results.
public int RaycastAll(Vector2d start, Vector2d end, PhysicsLayerMask layerMask, SwiftList<Physics2DHit> results)
Parameters
startVector2dendVector2dlayerMaskPhysicsLayerMaskresultsSwiftList<Physics2DHit>
Returns
RaycastAll(Vector2d, Vector2d, SwiftList<Physics2DHit>)
Writes all pure 2D colliders hit by the segment into results.
public int RaycastAll(Vector2d start, Vector2d end, SwiftList<Physics2DHit> results)
Parameters
startVector2dendVector2dresultsSwiftList<Physics2DHit>
Returns
RaycastAllBatch(ReadOnlySpan<PhysicsRaycast2DRequest>, SwiftList<Physics2DHit>, Span<PhysicsQueryHitRange>)
Executes multiple pure 2D segment raycasts and appends all hits into one caller-owned hit buffer.
public int RaycastAllBatch(ReadOnlySpan<PhysicsRaycast2DRequest> requests, SwiftList<Physics2DHit> hits, Span<PhysicsQueryHitRange> ranges)
Parameters
requestsReadOnlySpan<PhysicsRaycast2DRequest>hitsSwiftList<Physics2DHit>rangesSpan<PhysicsQueryHitRange>
Returns
RaycastBatch(ReadOnlySpan<PhysicsRaycast2DRequest>, Span<Physics2DHit>)
Executes multiple pure 2D segment raycasts and writes one closest-hit slot per request.
public int RaycastBatch(ReadOnlySpan<PhysicsRaycast2DRequest> requests, Span<Physics2DHit> closestHits)
Parameters
requestsReadOnlySpan<PhysicsRaycast2DRequest>closestHitsSpan<Physics2DHit>
Returns
Reset()
Resets context-local pure 2D query buffers.
public void Reset()
SweepCircle(Vector2d, Vector2d, Fixed64, out Physics2DHit)
Finds the closest pure 2D collider hit by sweeping a circle from start to end.
public bool SweepCircle(Vector2d start, Vector2d end, Fixed64 radius, out Physics2DHit hit)
Parameters
startVector2dendVector2dradiusFixed64hitPhysics2DHit
Returns
SweepCircle(Vector2d, Vector2d, Fixed64, PhysicsLayerMask, out Physics2DHit, LSCollider2D?, bool)
Finds the closest pure 2D collider on an included layer hit by sweeping a circle.
public bool SweepCircle(Vector2d start, Vector2d end, Fixed64 radius, PhysicsLayerMask layerMask, out Physics2DHit hit, LSCollider2D? excludedCollider = null, bool includeTriggers = true)
Parameters
startVector2dendVector2dradiusFixed64layerMaskPhysicsLayerMaskhitPhysics2DHitexcludedColliderLSCollider2DincludeTriggersbool
Returns
SweepCircleAll(Vector2d, Vector2d, Fixed64, PhysicsLayerMask, SwiftList<Physics2DHit>, LSCollider2D?, bool)
Writes all pure 2D colliders on included layers hit by sweeping a circle into results.
public int SweepCircleAll(Vector2d start, Vector2d end, Fixed64 radius, PhysicsLayerMask layerMask, SwiftList<Physics2DHit> results, LSCollider2D? excludedCollider = null, bool includeTriggers = true)
Parameters
startVector2dendVector2dradiusFixed64layerMaskPhysicsLayerMaskresultsSwiftList<Physics2DHit>excludedColliderLSCollider2DincludeTriggersbool
Returns
SweepCircleAll(Vector2d, Vector2d, Fixed64, SwiftList<Physics2DHit>)
Writes all pure 2D colliders hit by sweeping a circle into results.
public int SweepCircleAll(Vector2d start, Vector2d end, Fixed64 radius, SwiftList<Physics2DHit> results)
Parameters
startVector2dendVector2dradiusFixed64resultsSwiftList<Physics2DHit>
Returns
SweepCircleAllBatch(ReadOnlySpan<PhysicsSweepCircle2DRequest>, SwiftList<Physics2DHit>, Span<PhysicsQueryHitRange>)
Executes multiple pure 2D swept-circle queries and appends all hits into one caller-owned hit buffer.
public int SweepCircleAllBatch(ReadOnlySpan<PhysicsSweepCircle2DRequest> requests, SwiftList<Physics2DHit> hits, Span<PhysicsQueryHitRange> ranges)
Parameters
requestsReadOnlySpan<PhysicsSweepCircle2DRequest>hitsSwiftList<Physics2DHit>rangesSpan<PhysicsQueryHitRange>
Returns
SweepCircleBatch(ReadOnlySpan<PhysicsSweepCircle2DRequest>, Span<Physics2DHit>)
Executes multiple pure 2D swept-circle queries and writes one closest-hit slot per request.
public int SweepCircleBatch(ReadOnlySpan<PhysicsSweepCircle2DRequest> requests, Span<Physics2DHit> closestHits)
Parameters
requestsReadOnlySpan<PhysicsSweepCircle2DRequest>closestHitsSpan<Physics2DHit>